zl程序教程

您现在的位置是:首页 >  其他

当前栏目

pandas 读取文件时 header设置列名 index_col 设置索引 usecols 读取哪几列 parse_dates 将哪一列设置为时间类型 nrows 读取数据行数

文件pandas索引 设置 时间 类型 读取 index
2023-09-11 14:21:26 时间
header 表示将第几行设置为列名


header = None
header = 3

index_col 表示将某一列或某几列作为索引

index_col = ['a']
index_col = ['a','b']

usecols 表示读取哪一列

不设置为默认读取全部列

usecols = ['a','b','c']

parse_dates 表示将某一列设置为 时间类型

parse_dates = ['col']

nrows 表示读取的数据行数

nrows = 2