What is the point of .ix indexing for pandas Series

Viewed 24986

For the Series object (let's call it s), pandas offers three types of addressing.

s.iloc[] -- for integer position addressing;

s.loc[] -- for index label addressing; and

s.ix[] -- for a hybrid of integer position and label addressing.

The pandas object also performs ix addressing directly.

# play data ...
import string
idx = [i for i in string.uppercase] # A, B, C .. Z
t = pd.Series(range(26), index=idx) # 0, 1, 2 .. 25

# examples ...
t[0]              # --> 0
t['A']            # --> 0
t[['A','M']]      # --> [0, 12]
t['A':'D']        # --> [0, 1, 2, 3]
t.iloc[25]        # --> 25
t.loc['Z']        # --> 25
t.loc[['A','Z']]  # --> [0, 25]
t.ix['A':'C']     # --> [0, 1, 2]
t.ix[0:2]         # --> [0, 1]

So to my question: is there a point to the .ix method of indexing? Am I missing something important here?

Note: As of Pandas v0.20, .ix indexer is deprecated in favour of .iloc / .loc.

1 Answers
Related