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

Panel.iloc[] broken #3617

Closed
joeb1415 opened this issue May 15, 2013 · 2 comments · Fixed by #3618
Closed

Panel.iloc[] broken #3617

joeb1415 opened this issue May 15, 2013 · 2 comments · Fixed by #3618
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@joeb1415
Copy link

Panel.iloc[] doesn't index correctly given a mix of scalars and ranges

from pandas import Panel, date_range
from numpy.random import randn

p = Panel(randn(4, 4, 4))

print(p.iloc[:3, :3, :3].shape)
print(p.iloc[1, :3, :3].shape)
print(p.iloc[:3, 1, :3].shape)
print(p.iloc[:3, :3, 1].shape)
print(p.iloc[1, 1, :3].shape)
print(p.iloc[1, :3, 1].shape)
print(p.iloc[:3, 1, 1].shape)

Returns

[3, 3, 3]
(4, 3)
(4, 3)
(3, 3)
(3L,)
(4L,)
(4L,)
@joeb1415
Copy link
Author

DataFrame.iloc is fine though:

print(p.iloc[1].iloc[:3, :3].shape)

Returns:

(3, 3)

As expected.

@jreback
Copy link
Contributor

jreback commented May 16, 2013

Bug it was

thanks

pls give #3618 a try (and let me know if you find any other issues)

In [2]: print(p.iloc[:3, :3, :3].shape)
(3, 3, 3)

In [3]: print(p.iloc[1, :3, :3].shape)
(3, 3)

In [4]: print(p.iloc[:3, 1, :3].shape)
(3, 3)

In [5]: print(p.iloc[:3, :3, 1].shape)
(3, 3)

In [6]: print(p.iloc[1, 1, :3].shape)
(3,)

In [7]: print(p.iloc[1, :3, 1].shape)
(3,)

In [8]: print(p.iloc[:3, 1, 1].shape)
(3,)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants