Created
July 27, 2018 21:07
-
-
Save mhweber/4b4dfbc15e417176b17cba8d92f5e4da to your computer and use it in GitHub Desktop.
pandas groupby and aggregation example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| df = pd.DataFrame({'year' : pd.Series([1961, 1961, 1961, 1962, 1962,1963, 1963]), | |
| 'value' : pd.Series([0.4, 0.5, 0.2, 0.8, 0.9, 0.8, 0.7])}) | |
| df['max_values'] = pd.Series(df.groupby('year').value.max().values) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment