Skip to content
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

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

Closed
max-sixty opened this issue May 4, 2016 · 1 comment · Fixed by #16153
Closed
Labels
Period Period data type Resample resample method
Milestone

Comments

@max-sixty
Copy link
Contributor

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

@jreback
Copy link
Contributor

jreback commented May 4, 2016

so this is just true for PeriodIndex. DTI works.

Though upsampling is a bit odd for ohlc (as all of the values are the same). So I would match DTI.

@jreback jreback added Period Period data type Resample resample method labels May 4, 2016
@jreback jreback added this to the 0.18.2 milestone May 4, 2016
@jorisvandenbossche jorisvandenbossche modified the milestones: Next Major Release, 0.19.0 Aug 21, 2016
@jreback jreback modified the milestones: Next Major Release, 0.21.0 Sep 29, 2017
jreback pushed a commit that referenced this issue Oct 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Period Period data type Resample resample method
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants