es.davy.ai

Preguntas y respuestas de programación confiables

¿Tienes una pregunta?

Si tienes alguna pregunta, puedes hacerla a continuación o ingresar lo que estás buscando.

Tag: GROUPING

Agrupando valores hash similares

Cambio las imágenes por valores hash e intento clasificar las imágenes con valores hash similares en el mismo grupo. Por ejemplo: import imagehash img1_hash = imagehash.average_hash(Image.open(‘data/image1.jpg’)) img2_hash = imagehash.average_hash(Image.open(‘data/image2.jpg’)) img3_hash = imagehash.average_hash(Image.open(‘data/image3.jpg’)) img4_hash = imagehash.average_hash(Image.open(‘data/image4.jpg’)) print(img1_hash, img2_hash, img3_hash, img4_hash) >> 81c38181bf8781ff, 81838181bf8781ff, 81838181bf8781ff, ff0000ff3f00e7ff hash_lst = [[‘img1’, img1_hash], [‘img2’, img2_hash], . . . Read more

Agrupación y agregación fluida de MongoDB en C#

Mi aplicación .Net / C# almacena cierta información en Mongodb. Los documentos de Mongodb tienen la siguiente estructura correspondiente en C#: public class GlobalInfo { public ObjectId Id { get; set; } public string Country { get; set; } public string City { get; set; } public int Population { . . . Read more

Aplicación agrupada de funciones que devuelven un data.frame (sin un bucle for).

Necesito aplicar una función que devuelva un data.frame en un tibble agrupado. Algunos datos: df <- data.frame(start=1:10,end=21:30,g=sample(LETTERS[1:2],10,replace=TRUE)) ff <- function(start,end,… ) { out <- data.frame(T1=c(start,rev(start)),T2=c(end,rev(end))) return(out) } Luego, me gustaría hacer algo como esto: library(dplyr) library(purrr) df %>% group_by(g) %>% pmap_dfr( ff,.keep=TRUE) Para producir un tibble/data.frame como este: g start . . . Read more