In []: df = pd.DataFrame(index=range(10),columns=['a','b',1])

In []: df
Out[]:
     a    b    1
0  NaN  NaN  NaN
1  NaN  NaN  NaN
2  NaN  NaN  NaN
3  NaN  NaN  NaN
4  NaN  NaN  NaN
5  NaN  NaN  NaN
6  NaN  NaN  NaN
7  NaN  NaN  NaN
8  NaN  NaN  NaN
9  NaN  NaN  NaN

In []: df.ix[:,[0]]
Out[]:
     1
0  NaN
1  NaN
2  NaN
3  NaN
4  NaN
5  NaN
6  NaN
7  NaN
8  NaN
9  NaN

In []: df.ix[:,[0,1,2]]
Out[]:
     1    1    1
0  NaN  NaN  NaN
1  NaN  NaN  NaN
2  NaN  NaN  NaN
3  NaN  NaN  NaN
4  NaN  NaN  NaN
5  NaN  NaN  NaN
6  NaN  NaN  NaN
7  NaN  NaN  NaN
8  NaN  NaN  NaN
9  NaN  NaN  NaN

I know in this case one should use iloc, It's not clear what ix should do in this case, but the df.ix[:,[0]] case is certainly not what is expected.

How about either - issuing a warning or - raising an Exception

when asked to ix an index like this.

Comment From: jreback

this IS expected from ix though; it tries to 'guess' as you have a numeric index. use iloc instead.

http://pandas-docs.github.io/pandas-docs-travis/indexing.html#indexing-fallback

Comment From: bjonen

But if the guess is numeric index, then shouldn't it throw an IndexError as 0 is not in the index?

Comment From: jreback

nope....that is the defined behavior of .ix it assumes you mean the 0th index (as prior to loc/iloc no way to say get me the 0th column). That is why you are encouraged to use loc/iloc and not ix (however it was kept for back-compat reasons).

I agree its not intuitive and should not guess, but noone put in effort to put up the warning.

ok...so will mark this as a issue for 0.15.0 then (to put up a warning in a case like this)

Comment From: bjonen

Ok thanks

Comment From: TomAugspurger

Closing due to deprecation in https://github.com/pandas-dev/pandas/pull/15113