Skip to content

ohlc resampling returns a different type depending on upsampling vs downsampling #13083

Closed
@max-sixty

Description

@max-sixty

Upsampling returns a Series, Downsampling returns a DataFrame. Is this valid?

In [80]: series=pd.Series(range(10), index=pd.PeriodIndex(start='2000', freq='D', periods=10))

In [81]: series
Out[81]: 
2000-01-01    0
2000-01-02    1
2000-01-03    2
2000-01-04    3
2000-01-05    4
2000-01-06    5
2000-01-07    6
2000-01-08    7
2000-01-09    8
2000-01-10    9
Freq: D, dtype: int64

In [83]: series.resample('M').ohlc()
Out[83]: 
         open  high  low  close
2000-01     0     9    0      9

# returns a DataFrame

In [84]: series.resample('H').ohlc()
Out[84]: 
2000-01-01 00:00    0.0
...
2000-01-10 23:00    NaN
Freq: H, dtype: float64

# returns a series

on master

Metadata

Metadata

Assignees

No one assigned

    Labels

    PeriodPeriod data typeResampleresample method

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions