pandas and NumPy 3 · Grouping and combining
Aggregate by time period
Sum values by month. The index must be a datetime.
df.set_index("date")["sales"].resample("MS").sum()
Official pandas and NumPy 3 documentation
More grouping and combining commands
- Group and aggregate
- Create a pivot table
- Join two DataFrames
- Stack DataFrames
- Compute a moving average
- Save to a CSV file
All grouping and combining commands · pandas and NumPy 3 cheatsheet