<jupyter_start><jupyter_text>Groupby<jupyter_code>import pandas as pd
oo = pd.read_csv('data/olympics.csv',skiprows=4)
oo.head()<jupyter_output><empty_output><jupyter_text>The Groupby object<jupyter_code>oo.groupby('Edition')
type(oo.groupby('Edition'))
list(oo.groupby('Edition'))<jupyter_output><empty_output><jupyter_text>Iterating through groups<jupyter_code>for group_key, group_value in oo.groupby('Edition'):
    print(group_key)
    print(group_value)
type(group_value)<jupyter_output><empty_output><jupyter_text>Groupby computations<jupyter_code>oo.groupby('Edition').size()<jupyter_output><empty_output><jupyter_text>agg([...])<jupyter_code>oo.groupby(['Edition','NOC','Medal']).agg(['min','max','count'])
oo.groupby(['Edition','NOC','Medal']).size()<jupyter_output><empty_output><jupyter_text>agg({  : [ ... ]})<jupyter_code>oo.groupby(['Edition','NOC','Medal']).agg({'Edition' :['min','max','count']})
oo.loc[oo.Athlete == 'LEWIS, Carl'].groupby('Athlete').agg({'Edition' : ['min','max','count']})<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.2165543792107796, 'fraction_numerical': 0.0009624639076034649, 'mean_word_length': 14.072463768115941, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, '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': '153841', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 422, 'n_tokens_neox': 415, 'n_words': 28, 'path': 'basics/first/Ch07 Groupby.ipynb', 'repo_name': 'febin-varghese/Data-Science', 'size': '1039'}