# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # Stat
# import dataset from https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/06_Stats/US_Baby_Names/US_Baby_Names_right.csv

import pandas as pd

df = pd.read_csv("https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/06_Stats/US_Baby_Names/US_Baby_Names_right.csv")

df.head(10)

# #### Delete the column 'Unnamed: 0' and 'Id'

df = df.drop(["Unnamed: 0", "Id"], axis=1)
df.head()

# #### Are there more male or female names in the dataset?

df["Gender"].value_counts()

# #### Group the dataset by name and assign to names

df = df.drop(["Year"], axis =1)
df.head()

name = df.groupby("Name").sum()
name.head()
name.sort_values("Count", ascending = 0).head()

name.sort_values("Count", ascending = 1).head()

# #### How many different names exist in the dataset?

len(name)

# #### What is the name with most occurrences?

name.Count.idxmax()

# ####  How many different names have the least occurrences?

len(name[name.Count == name.Count.min()])

# #### What is the median name occurrence?

name[name.Count == name.Count.median()]

# #### What is the standard deviation of names?

name.Count.std()

name.Count.median()

# #### Get a summary with the mean, min, max, std and quartiles

name.describe()

StarcoderdataJupyterScriptsDedupFiltered