-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
rolling_apply only applicable to numeric columns #4964
Comments
this is a bit of work, because need right now the rollinging functions only accept float dtypes, so need a generator for object types (not that hard) in the code generator. then need to dispatch based on dtype. will put on the board for 0.14. |
Thanks, is there maybe an alternative solution how I could implement the functionality with the current pandas version? |
There's an embeded bug here (that's why i am astyping)...separate issue
|
Thanks, but I think you got me wrong, I am looking for a possibility to count at each point the number of new customers in the upcoming 10 days. Hence, I need to compare the names of the customers to see if they are new or already known. |
I think this will work. It is a 'manual' rolling_apply The key is return
|
Thanks, that is a great solution. Is there any possibility to use in your last statement [23] a TimeOffset (e.g. a week or month) to select the rows for the f function while still having the variable 'dates' on a daily basis? |
|
is it possible to ignore string columns and apply the rolling function to the rest? |
going to repurpose this issue to skip nuiscance columns in a dataframe In [4]: df = DataFrame({'A' : pd.date_range('20130101',periods=3),'B' : range(3)})
This is a supported op
This works
should work (but excluded |
closing in favor of #12537 |
@jreback Hello is there any possibility to get rolling.apply for objects in 2018?) It still ignores objects as of 0.22.0.
it's ok to ignore objects with built-in functions
but why can't i handle objects myself?
This example above is not really useful but I want to be able to apply function to a column that contains objects. The only solution I've found is to create your own DataFrame/Series type https://stackoverflow.com/questions/44479384/pandas-rolling-apply-doesnt-do-anything But I really think this should be in pandas by default. |
would always take a PR for this |
Hi everybody,
I discovered that the rolling_apply function is only applicable to numeric columns. I think this should be changed as this seems too limited to me. Let's take the following example,
Now I want to count all new customers each 10 days.
throws an exception "ValueError: could not convert string to float: Carl"
However, although meaningless a call with a numeric column such as:
works.
The text was updated successfully, but these errors were encountered: