import pandas as pd
path='D:/Desktop/'
SPXdaily=pd.read_csv(path+'exercise.csv')
SPXdaily
pd.read_csv(path+'SPXdaily.csv',header=0,index_col=None,usecols=['Date','Close'],nrows=10)
header:用来做列标题的行数。When header=0, the column are inferred from the first line of column.
index_col:Column(s) to use as the row labels of the DataFrame
usecols:Return a subset of the columns.
nrow:Number of rows of file to read. Useful for reading pieces of large files.
引入excel数据
pd.read_excel(path+'name.xlsx',sheet_name='sheet2')