1 回答

TA貢獻(xiàn)1776條經(jīng)驗(yàn) 獲得超12個(gè)贊
數(shù)據(jù)集位于資產(chǎn):總資產(chǎn):總資產(chǎn)(減去合并沖銷):周三水平 (WALCL)
使用with驗(yàn)證該
DATE
列是否采用日期時(shí)間格式。parse_dates
.read_csv
設(shè)置DATE
為索引
import pandas as pd
import numpy as np
# verify the DATE column is in a datetime format and set it as the index
dfData = pd.read_csv('WALCL.csv', skiprows=0, parse_dates=['DATE'], index_col='DATE')
# plot the data
ax = dfData.plot(figsize=(20, 8))
datemin = np.datetime64(dfData.index.min(), 'Y')
datemax = np.datetime64(dfData.index.max(), 'Y') + np.timedelta64(1, 'Y')
ax.set_xlim(datemin, datemax)
保留DATE為專欄
import pandas as pd
# read file
dfData = pd.read_csv('WALCL.csv', skiprows=0, parse_dates=['DATE'])
# plot data
ax = dfData.plot('DATE', 'WALCL', figsize=(20, 8))
添加回答
舉報(bào)