Pandas版本:0.19.2
系統版本:Windows 10
import pandas as pd
import numpy as np
dates = pd.date_range('1/1/2000', periods=8)
df_sanple = pd.DataFrame(np.random.randn(8, 4), index=dates, columns=['A', 'B', 'C', 'D'])
df_sanple
df_sanple.loc['2000-01-01','D']
df_sanple.loc['2000-01-01':'2000-01-03','C':'D']
執行結果:
沒有留言:
張貼留言