.csv文件内容如下:
方法1:
import pandas as pd
df = pd.read_csv(‘C:\Project\data\wbikes.csv’, sep=’;’, encoding=’latin1’, parse_dates=[‘Date’], dayfirst=True, index_col=’Date’)
print(df[:3])
print(df.columns)
方法2:
import csv
with open(‘C:\Project\pyProject\dataMining\day02\data\wbikes.csv’,’r’) as csvfile:
readCSV = csv.reader(csvfile, delimiter=’,’)
for row in readCSV:
print(row)