热线电话:13121318867

登录
2018-12-10 阅读量: 704
read.csv常用参数

通过在jupyter笔记本中按shift + tab可以看到任何功能的参数。下面给出了有用的用法:

# importing Pandas library

import pandas as pd

pd.read_csv(filepath_or_buffer = "pokemon.csv")

# makes the passed rows header

pd.read_csv("pokemon.csv", header =[1, 2])

# make the passed column as index instead of 0, 1, 2, 3....

pd.read_csv("pokemon.csv", index_col ='Type')

# uses passed cols only for data frame

pd.read_csv("pokemon.csv", usecols =["Type"])

# reutruns pandas series if there is only one colunmn

pd.read_csv("pokemon.csv", usecols =["Type"],

squeeze = True)

# skips the passed rows in new series

pd.read_csv("pokemon.csv",

skiprows = [1, 2, 3, 4])

0.0000
3
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子