how can i aggregate without group by in pandas
df.groupby(lambda _ : True).agg(new_col_name = ('col_name', 'agg_function'))
how can i aggregate without group by in pandas
df.groupby(lambda _ : True).agg(new_col_name = ('col_name', 'agg_function'))
pandas agg rename columns
grouped = df.groupby('id').agg({'col1': [('name1', 'sum')], 'col2': [('name2_mean', 'sum'), ('name2_custom_std', lambda x: np.std(x))]})
grouped.columns = grouped.columns.droplevel()
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us