Skip to content

DataFrame.ix[n] for numerical (float) indices has an error #707

@james18

Description

@james18

So my understanding for a DataFrame with numerical indices, DataFrame.ix[i] indexes to the position where index=i, and not the ith row of the DataFrame. Although I find this to be confusing, i accept that this was the decision that was made.

However, the getting and setting with .ix is not consistent

from pandas import DataFrame
df = DataFrame(['a','b','c'],index=[0,0.5,1])
df.ix[1] = 'zoo'
print df.ix[1]

Current:
'b'

Expected:
'zoo'

Basically, df.ix[1] returns 'b', of index 0.5, instead of 'zoo' of index 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions