Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ERR: Raise a better message when mixing positional and label indexing in loc/iloc #25753
Code Sample, a copy-pastable example if possible
import numpy as np data = DataFrame(np.arange(16).reshape((4, 4)), index=['Ohio', 'Colorado', 'Utah', 'New York'], columns=['one', 'two', 'three', 'four']) data[data < 5] = 0 print(data.iloc[['Colorado', 'Utah'], [3, 0, 1]]) # .ix is deprecated. Please use # .loc for label based indexing or # .iloc for positional indexing print(data.iloc[['Colorado', 'Utah'], [3, 0, 1]]) #TypeError: cannot perform reduce with flexible type print(data.loc[['Colorado', 'Utah'], [3, 0, 1]]) #KeyError: "None of [Int64Index([3, 0, 1], dtype='int64')] are in the [columns]"
I followed the suggesion to move the ix to iloc and this is what I have got