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: AGGREGATE-FUNCTIONS

Spark scala agrupa en un array y concaténalo.

Tengo un conjunto de datos con una serie de columnas que se ve así: (columnas: nombre, marca de tiempo, plataforma, conteo de clics, id) Joy 2021-10-10T10:27:16 apple 5 1 May 2020-12-12T22:28:08 android 6 2 June 2021-09-15T20:20:06 Microsoft 9 3 Joy 2021-09-09T09:30:09 android 10 1 May 2021-08-08T05:05:05 apple 8 2 Quiero . . . Read more

Multiplicación en el argumento FUN

Tengo este dataframe x <- data.frame( matrix( c(letters[1:3], c(“x”, “x”, “y”) , sample(c(rep(1,100),0), size = 1), sample(c(rep(1,100),0), size = 1), sample(c(rep(1,100),0), size = 1)), ncol = 3) ) Me gustaría hacer una multiplicación por grupo X e Y. Mi sugerencia agg <- aggregate(x$X3, by = list(x$X2), FUN = *) Me . . . Read more

Python: Ordenar cada fila y acumular los pesos.

Tengo el siguiente dataframe: df1 = pd.DataFrame( { “A_price”: [10, 12, 15], “B_price”: [20, 19, 29], “C_price”: [23, 21, 4], “D_price”: [45, 47, 44], }, index = [’01-01-2020′, ’01-02-2020′, ’01-03-2020′] ) df2 = pd.DataFrame( { “A_weight”: [0.1, 0.2, 0.4], “B_weight”: [0.2, 0.5, 0.1], “C_weight”: [0.3, 0.2, 0.1], “D_weight”: [0.4, 0.1, . . . Read more

Las uniones externas izquierdas agregan primero.

Tengo las siguientes tablas: CREATE TABLE categories( id SERIAL, ); CREATE TABLE category_translations( id SERIAL, name varchar NOT NULL, locale varchar NOT NULL, category_id integer NOT NULL ); CREATE TABLE products( id SERIAL, category_id integer NOT NULL ); CREATE TABLE line_items( id SERIAL, total_cents integer, product_id integer NOT NULL ); . . . Read more