解決《利用python進行數據分析》P139報錯問題 index must be monotonic increasing or decreasing
frame.reindex(index=['a','b','c','d'],method='ffill',columns=states)
報錯:index must be monotonic increasing or decreasing
修改代碼:把method=‘ffill’拿出來
注意,是method的方法,參數ffill后面加"()"
frame4=frame.reindex(index=['a','b','c','d'], columns=states).ffill()
結果為:
Texas Utah California a 1.0 NaN 2.0 b NaN NaN NaN c 4.0 NaN 5.0 d 7.0 NaN 8.0
————————————————
版權聲明:本文為CSDN博主「木里先森」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/mr_muli/article/details/83962897