Python数据帧:描述单个列

2024-03-28 21:43:53 发布

您现在位置:Python中文网/ 问答频道 /正文


Tags: python
2条回答

只需在正方形braquets中添加列名:

df['column_name'].describe()

示例:

enter image description here

要获取单列:

df['1']

要获得少列:

df[['1','2']]

要获取单行:

按行名或索引df.loc['B']

要获得精确字段:

df['1']['C']

import pandas as pd
data = pd.read_csv("ad.data", header=None)
data[111].describe()

或者例如

lastindice = data[data .columns[-1]]
lastindice.describe()

相关问题 更多 >