728x90
반응형
In [29]:
import pandas as pd
In [30]:
url = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/06_Stats/US_Baby_Names/US_Baby_Names_right.csv'
baby_names = pd.read_csv(url,sep=',')
In [31]:
baby_names.head(10)
Out[31]:
In [32]:
del baby_names['Unnamed: 0']
del baby_names['Id']
baby_names.head()
Out[32]:
In [33]:
baby_names['Gender'].value_counts()
Out[33]:
In [59]:
# 이름별 총 횟수를 계산하고 싶은 것
# continuous인 Year을 delete해야함
# del baby_names['Year']
names = baby_names.groupby('Name').sum()
names.sort_values(by='Count',ascending=False).head()
Out[59]:
In [60]:
len(names)
Out[60]:
In [61]:
names.idxmax()
Out[61]:
In [62]:
len(names[names['Count']==names['Count'].min()])
Out[62]:
In [64]:
names[names['Count'] == names['Count'].median()]
Out[64]:
In [69]:
names.Count.std()
Out[69]:
In [70]:
names.describe()
Out[70]:
728x90
반응형