簡(jiǎn)介: 本文將介紹Series和DataFrame的各種屬性與方法对途。
Series
屬性 attribute
- index屬性,得到的是Index對(duì)象
series.index
- index 的name屬性
index的name屬性非常重要瘩缆,注意其區(qū)分columns和index的區(qū)別
series.index.name
- values屬性赃磨,得到的是array對(duì)象
series.values
- Index對(duì)象
在構(gòu)建Series或者DataFrame時(shí),所用的任何數(shù)組或者其它序列的標(biāo)簽都會(huì)被轉(zhuǎn)換成一個(gè)Index對(duì)象初婆,它是一個(gè)不能被更改的對(duì)象
方法 method
describe()方法
value_counts()方法
參數(shù)normalize机打,歸一化
value_counts(normalize=True)
unique()方法
nunique()方法
提取數(shù)字mean()
plot()
DataFrame
屬性 attribute
- dtypes
查看columns的數(shù)據(jù)類型
dataframe.dtypes
- index矫户,columns,values
與Series相同残邀。
方法 method
-
查看數(shù)據(jù)
- head()方法
查看數(shù)據(jù)的前5行皆辽,也可以指定行數(shù)n。 相應(yīng)的還有tail()方法
dataframe.head()
dataframe.head(15)
dataframe.tail()
dataframe.tail(15)
- describe()方法
描述顯示數(shù)據(jù)快速統(tǒng)計(jì)摘要
dataframe.describe()
- sort()方法
又分為sort_index芥挣,sort_values等
所有文章列表
pandas使用技巧總覽