2017-10-21 90 views
0

我打開一個CSV文件,其中索引由日期組成的pandas DataFrame。我想處理缺失的時間索引,那麼最好的辦法是什麼?在Python數據框中處理缺失索引的最佳方式是什麼?

我知道filter()fillna(),還有另外一個功能嗎?

+0

'replace'也可以用Na – Wen

+1

幫助是的,有'resample'。或者,也許,'dropna'。 –

+0

可用的樣品數據? – Dark

回答

0

我認爲你正在尋找重新索引即

df = df.reindex(pd.date_range(df.index.min(),df.index.max(),freq='D')) 

在移除南行的情況下,然後

df = df.dropna() 
相關問題