AttributeError: 'DataFrame' object has no attribute 'ix'
I am getting this error when I try to use the .ix attribute of a pandas data frame to pull out a column, e.g. df.ix[:, 'col_header']
.
AttributeError: 'DataFrame' object has no attribute 'ix'
The script worked this morning, but this afternoon I ran it in a new Linux environment with a fresh install of Pandas. Has anybody else seen this error before? I've searched here and elsewhere but can't find it.
Solution 1:
try df.iloc[:, integer]
.ix
is deprecated
By the way, df.loc[:,'col_header']
is for str or Boolean indexing
Solution 2:
Change .ix to .loc and it should work correctly.
Solution 3:
A fresh install today (Jan 30, 2020) would install pd.__version__ == '1.0.0'
. With that comes a removal of many deprecated features.
Removed Series.ix and DataFrame.ix (GH26438)