4 ms·
I find the following Pandas code pretty easy to read: (df .groupby(['a', 'b', 'c'], as_index=False) .agg({'d': sum, 'e': mean, 'f', np.std}) .assign
by avdempsey 11y ago
I find the following Pandas code pretty easy to read:
(df
.groupby(['a', 'b', 'c'], as_index=False)
.agg({'d': sum, 'e': mean, 'f', np.std})
.assign(g=lambda x: x.a / x.c)
.query("g > 0.05")
.merge(df2, on='a'))
There are now methods in pandas to do pretty much anything, so you can chain them together into one easy-to-read manipulation without lots of intermediate variables.