You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In [73]: pd.Index.asof?
Type: instancemethod
String form: <unbound method Index.asof>
File: c:\anaconda\lib\site-packages\pandas\core\index.py
Definition: pd.Index.asof(self, label)
Docstring:
For a sorted index, return the most recent label up to and including
the passed label. Return NaN if not found
while asof only works for a time series.
Clarify the docs that asof only works for DatetimeIndex (and PeriodIndex?)
Why is this actually restricted to timestamps? This functions seems also possibly useful to me for other index types? Something like
In [74]: idx = pd.Index([1,2,3,8,9])
In [75]: idx.asof(5) # gives now TypeError
3
Instead of having to do:
In [78]: idx[idx.searchsorted(5) - 1]
Out[78]: 3
The text was updated successfully, but these errors were encountered:
jorisvandenbossche
changed the title
API/ODC: unclear scope of index.asof
API/DOC: unclear scope of index.asof
Nov 14, 2014
actually a much bigger issue is that this should raise on a non-monotonic index (or at least show a PerformanceWarning). and prob should provide a side argument as well (and thus its very close to searchsorted, except when the label is actually in the index).
From http://stackoverflow.com/questions/26918045/python-pandas-typeerror-cannot-compare-type-timestamp-with-type-float
The docstring of
Index.asof
says:while
asof
only works for a time series.Clarify the docs that
asof
only works forDatetimeIndex
(and PeriodIndex?)Why is this actually restricted to timestamps? This functions seems also possibly useful to me for other index types? Something like
Instead of having to do:
The text was updated successfully, but these errors were encountered: