A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/2304 below:

Broadcasting bug with datetime.date index? · Issue #2304 · pandas-dev/pandas · GitHub

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4