标签:col 数字 randn size 数值 min div value span
4.1 series对象的查看
s = pd.Series(np.random.randn(5)) s.axes#索引信息 s.empty#判断整体是否为空 s.ndim#返回对象维度 s.size#返回对象长度,或则说元素个数 s.values#以数组形式返回系列中的实际数据值
4.2 Dataframe对象的查看
d = {‘Name‘:pd.Series([‘Tom‘,‘James‘,‘Ricky‘,‘Vin‘,‘Steve‘,‘Minsu‘,‘Jack‘]), ‘Age‘:pd.Series([25,26,25,23,30,29,23]), ‘Rating‘:pd.Series([4.23,3.24,3.98,2.56,3.20,4.6,3.8])} df = pd.DataFrame(d) df df.T df.axes#返回行索引及列标签相关信息 df.dtypes df.empty df.ndim df.shape#返回规模形状 df.size#返回所有值的个数 df.values
4.3 Dataframe对象的描述性统计
d = {‘Name‘:pd.Series([‘Tom‘,‘James‘,‘Ricky‘,‘Vin‘,‘Steve‘,‘Minsu‘,‘Jack‘, ‘Lee‘,‘David‘,‘Gasper‘,‘Betina‘,‘Andres‘]), ‘Age‘:pd.Series([25,26,25,23,30,29,23,34,40,30,51,46]), ‘Rating‘:pd.Series([4.23,3.24,3.98,2.56,3.20,4.6,3.8,3.78,2.98,4.80,4.10,3.65])} df = pd.DataFrame(d) df.sum()#直接调用将对每一列求和,字符列将直接合并 df.sum(1)#对行求和 df.sum(0)#对列进行求和 df.mean() df.std() df.describe()#默认汇总所有数字列,include=[‘number‘] df.describe(include=[‘object‘])#数值型变量(include=[‘number‘]),离散型变量(include=[‘object‘]) df.describe(include=‘all‘)
标签:col 数字 randn size 数值 min div value span
原文地址:https://www.cnblogs.com/lhjc/p/12807363.html