<jupyter_start><jupyter_text>GroupByimport dataset from https://raw.githubusercontent.com/justmarkham/DAT8/master/data/drinks.csv<jupyter_code>import pandas as pd
df = pd.read_csv("https://raw.githubusercontent.com/justmarkham/DAT8/master/data/drinks.csv")
df.head(10)<jupyter_output><empty_output><jupyter_text>Which continent drinks more beer on average?<jupyter_code>df.groupby("continent").beer_servings.mean()
df.groupby("country").total_litres_of_pure_alcohol.mean()<jupyter_output><empty_output><jupyter_text>For each continent print the statistics for wine consumption<jupyter_code>df.groupby("continent").wine_servings.describe()<jupyter_output><empty_output><jupyter_text>Print the mean alcohol consumption per continent for every column<jupyter_code>df.groupby("continent").mean()
df.groupby("country").mean()<jupyter_output><empty_output><jupyter_text>Print the median alcohol consumption per continent for every column<jupyter_code>df.groupby("continent").median()<jupyter_output><empty_output><jupyter_text>Print the mean, min and max values for spirit consumption<jupyter_code>df.groupby("continent").spirit_servings.agg(["mean", "max", "min"])
df.groupby("continent").wine_servings.agg(["max", "min", "mean"])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13705179282868526, 'fraction_numerical': 0.0031872509960159364, 'mean_word_length': 11.313725490196079, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '625431', 'license': 'MIT', 'n_tokens_mistral': 435, 'n_tokens_neox': 425, 'n_words': 58, 'path': 'DataTalks_GroupBy I.ipynb', 'repo_name': 'gympohnpimol/Pandas-Data-Talks', 'size': '1255'}