Tag: AGGREGATE-FUNCTIONS
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
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
seleccionar el id de la tabla basado en el salario más alto de cada depto tabla Id dept salario 1 support 25000 2 support 20000 3 development 35000 4 development 25000 5 development 30000 select Id from table where salario In (select max(salario) from table group by dept) Si ejecuto . . . Read more
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
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