文章目录


【数据分析与预处理】 ---- 查看基本数据信息_python

1 查看数据规模 — 数据的维度 shape

shape = data.shape
print(shape)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_数据类型_02


2 查看各变量的数据类型 dtypes


dtypes = data.dtypes
print(dtypes)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_数据分析_03


3 查看数据整体信息 info()

info = data.info()
print(info)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_数据分析_04


4 查看数据描述 describe()

describe = data.describe()
print(describe)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_数据分析_05


5 查看列名 — 字段 columns

columns = data.columns
print(columns)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_数据类型_06


6 查看行名 — 索引 index

index = data.index
print(index)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_python_07


7 查看数据前后5行 head()、tail()

head = data.head()
tail = data.tail()
print(head)
print("*"*50)
print(tail)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_字段_08


8 查看某一列的值(唯一)values、unique()

city = data['城市'].values
city_unique = data['城市'].unique()
print(city)
print(city_unique)
print("-"*50)

【数据分析与预处理】 ---- 查看基本数据信息_python_09