Skip to content

Panel arguments can no longer be named. #3556

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
etyurin opened this issue May 9, 2013 · 6 comments · Fixed by #3558
Closed

Panel arguments can no longer be named. #3556

etyurin opened this issue May 9, 2013 · 6 comments · Fixed by #3558

Comments

@etyurin
Copy link

etyurin commented May 9, 2013

This code used to work some time around version 0.10, but now generates a ValueError:

In [14]: y
Out[14]:
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 3 (major_axis) x 2 (minor_axis)
Items axis: z1 to z2
Major_axis axis: 0 to 2
Minor_axis axis: a to b

In [15]: y.transpose('minor', 'major', 'items')
Out[15]:
<class 'pandas.core.panel.Panel'>
Dimensions: 2 (items) x 3 (major_axis) x 2 (minor_axis)
Items axis: a to b
Major_axis axis: 0 to 2
Minor_axis axis: z1 to z2

In [16]: y.transpose( items='minor', major='major', minor='items')

ValueError Traceback (most recent call last)
in ()
----> 1 y.transpose( items='minor', major='major', minor='items')

/usr/local/lib/python2.7/dist-packages/pandas-0.12.0.dev_be25266-py2.7-linux-x86_64.egg/pandas/core/panel.pyc in transpose(self, _args, *_kwargs)
1176 except (IndexError):
1177 raise ValueError(
-> 1178 "not enough arguments specified to transpose!")
1179
1180 axes = [self._get_axis_number(kwargs[a]) for a in self._AXIS_ORDERS]

ValueError: not enough arguments specified to transpose!

@jreback
Copy link
Contributor

jreback commented May 9, 2013

try

y.transpose(items='minor',major_axis='major',minor_axis='items')

minor and major are axis aliases but don't allow them here...let me take a look

@cpcloud
Copy link
Member

cpcloud commented May 9, 2013

@jreback passing only kwargs will fail here because args will be an empty list thus raising an IndexError. use of args and kwargs here seems like a bad idea since you already know precisely how many and the names of the axes. why not just have named arguments here? if they must be kept you can just assert args or kwargs and len(args) + len(kwargs) == 3 and then the code should work.

@jreback
Copy link
Contributor

jreback commented May 9, 2013

his is an easy fix
it just needs to accept the aliases
I'll fix tom (I had meant to keep the API the same)

@cpcloud
Copy link
Member

cpcloud commented May 9, 2013

@jreback I have a pr ready for this, should i submit?

@jreback
Copy link
Contributor

jreback commented May 9, 2013

oh if u have I ahead
I'll take a look

@jreback
Copy link
Contributor

jreback commented May 10, 2013

closed by #3558

@etyurin thanks for the report

@jreback jreback closed this as completed May 10, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants