-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH: Implement Panel pct_change #6909
Conversation
@@ -1130,11 +1130,20 @@ def shift(self, lags, freq=None, axis='major'): | |||
if freq: | |||
return self.tshift(lags, freq, axis=axis) | |||
|
|||
# TODO: why raise? axis=0 works, seems to be fine. need to chcek aligning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback any idea why this isn't allowed? wp.shift(0)
doesn't raise, and seems to produce the correct answer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
their is a perf issue currently because of the recent change of panel.shift to generic.shift
see #6826
I think wp.shift(0) is technically ok (though not intuitive)
prob should have a panel.shift that enforces kwargs (and doesn't have positional args at all)
you can use some of the machinery in reindex to detect the correct signatures
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'm going to hold off on touching Panel.shift() until #6826 is settled.
I added a vbench, but maybe it isn't worth it since really all that's happing is a panel.shift() and a panel.div(). Should I take it out? |
it's fine |
instead of specifying the items axis use info_axis for ndim > 2 maybe this should also be explict for ndim > 2 |
I changed the default axis to major to be more consistent with |
axis should default to stat_axis (which is 1 for a panel) |
Had to change the implementation in generic.pct_change to not pass `periods` as a keyword arg to generic. Once the signitures of DataFrame.shift() and Panel.shift() are aligned, this change can be reverted.
I finally understand what you meant about the axes (I've never really understood what |
gr8 - generic is good! makes maint easier u can simply put in the Panel4D notimementrd list (as this is prob not intuitive), look in panelnd for a list of functions that it disables |
Actually this will already raise NotImplemented since |
ok gr8 |
ENH: Implement Panel pct_change
Closes #6904
There's just a bit of extra index handling that needs to be done before moving on to
generic.pct_change()
. I had to adjust that to use the.div
and.sub
ops instead of/
and-
to work with panels.I wasn't sure why axis wasn't included as an actual names keyword arg.
generic
just looks for it in **kwargs. I did the same in panel.A related issue was the
Panel.shift()
has a different argument signature thangeneric.shift()
. I can make those consistent and put in a deprecation warning in this issue or in a new one.