<jupyter_start><jupyter_text>Group By

Aggregate data BY a column. 

 How?

1. Group your data by a specific column by using the `.groupby()` function. 
2. Aggregate data using one of the Pandas aggregation functions below: 
    - `count()` – Number of non-null observations
    - `sum()` – Sum of values
    - `mean()` – Mean of values
    - `median()` – Arithmetic median of values
    - `min()` – Minimum
    - `max()` – Maximum
    - `mode()` – Mode
    - `std()` – Standard deviation
    - `var()` – Variance
3. Optionally, use the `.reset_index()` function to switch the specified column from an index to a column.<jupyter_code># 1. Use groupby
# 2. Use groupby with an aggregation function e.g. sum()
# 3. Use groupby with an aggregation function e.g. sum() and reset_index()
# save the full example to a new dataframe 
# bar plot of total sales by city
# bar plot of total sales by product line and customer type
# line plot of total sales by date<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10558375634517767, 'fraction_numerical': 0.006091370558375634, 'mean_word_length': 3.343612334801762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '189805', 'license': 'MIT', 'n_tokens_mistral': 310, 'n_tokens_neox': 291, 'n_words': 143, 'path': 'day-2/04-ins_plotly/unsolved/supermarket-sales.ipynb', 'repo_name': 'jonathanneo/intro-to-python', 'size': '985'}