-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
df.at_time NotImplementedError {asof] #7873
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
Comments
this is a dupe of #3004. |
pls give a complete copy-pastable example |
@hdascapital
something like
|
If I reindex I will destroy the value of the timestamps, nevermind the connection I have with other data liked to that index. Let me complement my request. Sorry for the form, but this is my first time here. Let's think of the dataframe Let's say you want to get the the values at 2 pm for each day
Then you would get 1, 3, 6, However, imagine that you have a dataframe like the one in the example, but with all the data with the minutes in between, except for some reason you don't have the timestamp '20130103 2:00'. I was thinking that 1, 3, 5, 6. Thanks for your help |
not sure what you mean by
|
I got it. Amazing. Thanks a lot. |
that said, this could be implemented (essentially like that) |
@jreback One consideration, if you are going to implement this the way you wrote it. If you are handling financial data, some of it is business days, others is business days + sunday afternoon. When you do df.reindex, it doesn't take that into account and that distorts your data. I don't know if this is clear. Let me know. Thanks |
Have a look here: http://pandas.pydata.org/pandas-docs/stable/timeseries.html#dateoffset-objects you can construct the reindexer any way you want. and this would be implemented internally (and I might actually do a subtraction of values instead), might be faster. But this is way way down on the priority list. So, if you could like to take a stab, go for it. |
Is asof supposed to get the nearest or the next? (is ffill only next?) @hdascapital Like I said on ML if you can fix this at indexer_at_time it will propagate. This would make a good first PR :) |
might be (or prob should be) a keyword for before/after/nearest |
closing in favor of master issue #8845 |
The asof functionality int the at_time function gives a NotImplemented Error
df1 = df.at_time(time(15, 0), asof=True)
asof is very useful. If implemented it would allow us to use the at_time functionality and work with data that might not be complete, or don't have homogeneous time stamps. It would enable us to get the "closest" observation to the desired time for subsetting.
Thanks
Hernan
NotImplementedError Traceback (most recent call last) <ipython-input-28-3c10b7e963c9> in <module>() ----> 1 df2 = df1.at_time(time(15, 0), asof=True) C:\Users\Hernan\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\core\generic.pyc in at_time(self, time, asof) 2767 """ 2768 try: -> 2769 indexer = self.index.indexer_at_time(time, asof=asof) 2770 return self.take(indexer, convert=False) 2771 except AttributeError: C:\Users\Hernan\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tseries\index.pyc in indexer_at_time(self, time, asof) 1689 1690 if asof: -> 1691 raise NotImplementedError 1692 1693 if isinstance(time, compat.string_types): NotImplementedError:
The text was updated successfully, but these errors were encountered: