pandas查看数据常用方法(以excel为例)

目录

 

1.查看指定行数的数据head()

2. 查看数据表头columns

3.查看索引index

4.指定索引列index_col

5.按照索引排序

6.按照数据列排序sort_values()

 7.查看每列数据类型dtypes

8.查看指定行列数据loc

9.查看数据是否为空isnull()

 

1.查看指定行数的数据head()

(1)数据.head()默认查看五行数据

5f24d27ed4a34fb48e2a9c2c080ccb7c.png

(2)查看指定行数

数据.head(行数) 

d0dde1046fb0442f990692bda7364cd1.png

2. 查看数据表头columns

数据.columns4a3a4897eafb4762953dd4f4adc97e5f.png

3.查看索引index

数据.index

4.指定索引列index_col

pd.read_excel(路径,index_col=“”

a02148fe6b9c46dfa958e1b3ceb421df.png

5.按照索引排序

pd.read_excel(路径).sort_index()

cf8a3f8f71494f93988116e420993ceb.png

6.按照数据列排序sort_values()

数据.sort_values("列")

c178944806344fe993ef4bc898afdc2f.png

 7.查看每列数据类型dtypes

数据.dtypes

11b5aa5a1b574ed88ef87904df217269.png

8.查看指定行列数据loc

数据.loc[行][列]

ded5fad61a734f9887f377ae75fffe9f.png

9.查看数据是否为空isnull()

数据.isnull()

True表示空,False表示不为空

b23db58592fe44e9906562d9e192b4e6.png

 

 

 

 

 

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-18 04:10:01       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-18 04:10:01       100 阅读
  3. 在Django里面运行非项目文件

    2024-01-18 04:10:01       82 阅读
  4. Python语言-面向对象

    2024-01-18 04:10:01       91 阅读

热门阅读

  1. Matlab | SISO系统差分方程求解(附matlab源码)

    2024-01-18 04:10:01       51 阅读
  2. vimrc配置文件

    2024-01-18 04:10:01       51 阅读
  3. Oracle JDK 8 中的 computeIfAbsent 方法及实践

    2024-01-18 04:10:01       46 阅读
  4. 设计模式之行为型模式

    2024-01-18 04:10:01       40 阅读
  5. Codeforces Round 920 (Div. 3)

    2024-01-18 04:10:01       56 阅读
  6. VCG 网格清洗之移除小组件

    2024-01-18 04:10:01       54 阅读
  7. 3、python布尔类型和条件表达式

    2024-01-18 04:10:01       50 阅读
  8. Ubuntu 从零开始配置环境

    2024-01-18 04:10:01       51 阅读
  9. [网络安全]DHCP 部署与安全

    2024-01-18 04:10:01       46 阅读
  10. CSS 高频面试题

    2024-01-18 04:10:01       50 阅读