Resample with OHLC sometimes results in series on pandas release 0.18.0.rc1 · Issue #12332 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Description
In [1]: import pandas as pd
In [2]: index = pd.date_range('1-1-2000', '2-15-2000', freq='h')
In [3]: index = index.union(pd.date_range('4-15-2000', '5-15-2000', freq='h'))
In [4]: s = pd.Series(range(len(index)), index=index)
In [5]: a = s.loc[:'4-15-2000'].resample('30T').ohlc()
In [6]: b = s.loc[:'4-14-2000'].resample('30T').ohlc()
In [7]: a.head() Out[7]: open high low close 2000-01-01 00:00:00 0.0 0.0 0.0 0.0 2000-01-01 00:30:00 NaN NaN NaN NaN 2000-01-01 01:00:00 1.0 1.0 1.0 1.0 2000-01-01 01:30:00 NaN NaN NaN NaN 2000-01-01 02:00:00 2.0 2.0 2.0 2.0
In [8]: b.head() Out[8]: 2000-01-01 00:00:00 0.0 2000-01-01 00:30:00 NaN 2000-01-01 01:00:00 1.0 2000-01-01 01:30:00 NaN 2000-01-01 02:00:00 2.0 Freq: 30T, dtype: float64
In [9]: pd.version Out[9]: u'0.18.0rc1'