Reputation: 11
ValueError: index must be monotonic increasing or decreasing [Jupyter Notebook Image][1]
I am practicing the above code snippet from the book python for data analysis by Wes McKinney
I create a DataFrame like this
frame=DataFrame(np.arange(9).reshape((3,3)), index=['a','c','d'], columns=['Ohio','Texas','California'])
when I try to reindex it like this:
states=['Texas','Utah','California']
frame.reindex(index=['a','b','c','d'],method='ffill', columns=states)
why is ValueError being raised?
Upvotes: 0
Views: 135
Reputation: 11
You can use
frame.reindex(index=['a', 'b', 'c', 'd'], columns=states).ffill()
Upvotes: 1