main

2023/10/11

pandas tricks

 a list of aggregation function for groupby:

min, max, mean, median, sum, count, std, var, size, describe, nuniaue, idxmax, idxmin.


df.groupby([‘airline’, ‘weekday’])[‘cancelled’,’diverted’].agg([‘sum’,’mean’]).head()


df.groupby([‘airline’, ‘weekday’])[‘cancelled’,’diverted’].agg({“dist”:[‘sum’,’mean’]).head()

No comments:

Post a Comment

How to Supercharge Your Python Classes with Class Methods

  How to Supercharge Your Python Classes with Class Methods | by Siavash Yasini | May, 2024 | Towards Data Science As we just mentioned, a c...