Skip to content

Weird results grouping data by day #1580

Closed
@danse

Description

@danse

Hi I was feeding pandas (0.8.0rc2) with dates and found some errors. The
amounts from following csv file are grouped by date, but the sums for some days
are wrong:

2011-02-02 resulting: 0 correct: 40
2011-08-21 resulting: 3 correct: 133
2012-10-22 resulting: 157 correct: 27

This is the script I am running:

import sys
import pandas

f=pandas.read_csv(sys.stdin, index_col=1, parse_dates=True)

f.sort()
f=f.resample('D', how='sum')
f['amount'] = f['amount'].fillna(0)

f.to_csv(sys.stdout)

Maybe I'm using the time series methods in a wrong way.

The file with data is not too long, it is hosted here: https://raw.github.com/danse/sparkles/master/cleaned.csv

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