Skip to content

resample with numpy.product gives unexpected results #5586

Closed
@ruidc

Description

@ruidc
import datetime
import numpy
import pandas

index = pandas.DatetimeIndex(start=datetime.date(2012, 1, 31), freq='M', periods=12)

ts = pandas.Series(range(12), index=index)
df = pandas.DataFrame(dict(A=ts, B=ts+2))

print df

# Correct
print df.resample('M', how=numpy.sum)
# Incorrect
print df.resample('M', how=numpy.product)
# Correct
print df.resample('Q', how=numpy.sum)
# Incorrect
print df.resample('Q', how=numpy.product)

for print df.resample('Q', how=numpy.product), was expecting:

2012-03-31   2*1*0   4*3*2
2012-06-30   5*4*3   7*6*5
2012-09-30   8*7*6  10*9*8
2012-12-31  11*10*9  13*12*11

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions