Skip to content

Broadcasting bug with datetime.date index? #2304

Closed
@mcobzarenco

Description

@mcobzarenco

Guys,

It seems to be a problem with broadcasting when having a datetime.date index, do you know what may be causing this?

Example:

index = index=[datetime.date(2012, 1, 1), datetime.date(2012, 1, 2)]
columns=['a', 'b']
df = pandas.DataFrame([[1., 2.], [3., 4.]], index, columns)

>>> print( df.mean(1) )
2012-01-01    1.5
2012-01-02    3.5

>>> print( (df - df.mean(1)).to_string() )
             a   b  2012-01-01  2012-01-02
2012-01-01 NaN NaN         NaN         NaN
2012-01-02 NaN NaN         NaN         NaN

The columns somehow end up being the union of the inital columns and the index. The above code works OK when using datetime.datetime instead.

Many thanks,
Marius

Metadata

Metadata

Assignees

No one assigned

    Labels

    Testingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions