Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior on Series.irow (Series.iget) with non-unique index #1694

Closed
manuteleco opened this issue Jul 27, 2012 · 1 comment

Comments

@manuteleco
Copy link

commented Jul 27, 2012

Hi,

Series.irow(i) (and also Series.iget(i)), with i being an integer, returns more than one value on Series with non-unique indexes if the index at location i has duplicates. This is not the behavior I expected and it is also different from the behavior shown by DataFrame.irow(i), since it only returns the row located at position i regardless of any existing index duplicates. Also the documentation for Series.irow/Series.iget specifies that an "int" parameter should return a "scalar" value, so I guess this might be a bug.

Here is some sample code I've run using pandas '0.8.2.dev-f5a74d4':

In [52]: s = Series([0, 1, 2], index=[0, 1, 0])

In [53]: s.irow(0)  # here I was expecting 0
Out[53]: 
0    0
0    2

In [54]: s.irow(1)
Out[54]: 1

In [55]: s.irow(2)  # here I was expecting 2
Out[55]: 
0    0
0    2

and its DataFrame counterpart:

In [56]: df = DataFrame([[0], [1], [2]], index=[0, 1, 0])

In [57]: df.irow(0)
Out[57]: 
0    0
Name: 0

In [58]: df.irow(1)
Out[58]: 
0    1
Name: 1

In [59]: df.irow(2)
Out[59]: 
0    2
Name: 0

Thanks and regards.

@wesm

This comment has been minimized.

Copy link
Member

commented Aug 2, 2012

Yes, it's a bug. Slated for 0.8.2

@wesm wesm closed this in cb5a31f Aug 10, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.