1.数据导入
df=pd.read_csv('Pokemon.csv',encoding="ISO-8859-1")
df.head()
2.查看数据
df.shape
df.shape[0]
df.shape[1]
df.columns #列名
df.index #行名
df.dtypes
df.head()
df.tail()
df.sample()
df.describe()
pd.set_option('max_colwidth',8) #设置每一行的最大宽度,恢复原设置方法
pd.reset_option('max_colwidth')
loc操作与iloc
loc通过label定位;iloc通过position定位
df.loc[[0,5],['名称','生命点数']]
df.iloc[0:10,[0,1]]
df[:3]
3.数据筛选与操作`
df[df['综合能力']>400].head()
df[df['世代数']==1]
df.insert(4,'能力600',df['综合能力']>=600)