Skip to content

What to do with irow in case of duplicate index? #1374

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

Closed
lodagro opened this issue Jun 1, 2012 · 1 comment
Closed

What to do with irow in case of duplicate index? #1374

lodagro opened this issue Jun 1, 2012 · 1 comment
Labels
Milestone

Comments

@lodagro
Copy link
Contributor

lodagro commented Jun 1, 2012

Since irow translates the integer index to a label one and then retrieves the row, in case of duplicate index multiple rows are returned.

In [34]: df = pandas.DataFrame(np.random.rand(3,3), columns=list('ABC'), index=list('aab'))

In [35]: df
Out[35]:
          A         B         C
a  0.031057  0.528825  0.694592
a  0.705572  0.122005  0.754107
b  0.475423  0.048636  0.224495

In [36]: df.irow(0)
Out[36]:
          A         B         C
a  0.031057  0.528825  0.694592
a  0.705572  0.122005  0.754107

In [37]: df.irow(1)
Out[37]:
          A         B         C
a  0.031057  0.528825  0.694592
a  0.705572  0.122005  0.754107

In [38]: df.irow(2)
Out[38]:
A    0.475423
B    0.048636
C    0.224495
Name: b
@wesm wesm closed this as completed in 2e95a0f Jun 3, 2012
@wesm
Copy link
Member

wesm commented Jun 3, 2012

I put in a number of assorted hacks to make icol and irow work with duplicates. Will need to review the code at some point in the future to see if it's possible to clean up a bit more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants