Closed
Description
Hi,
We came across this bug while attempting to demean a DataFrame. Here's typical behavior:
aapl = DataReader('AAPL', data_source='yahoo')
aapl - aapl.mean(1)
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 251 entries, 2011-09-19 00:00:00 to 2012-09-14 00:00:00
Data columns:
Open 251 non-null values
High 251 non-null values
Low 251 non-null values
Close 251 non-null values
Volume 251 non-null values
Adj Close 251 non-null values
dtypes: float64(6)
However, if we perform this same operation with an Int64Index rather than a DatetimeIndex, we get the following:
aapl = DataReader('AAPL', data_source='yahoo')
aapl.index = range(251)
aapl - aapl.mean(1)
<class 'pandas.core.frame.DataFrame'>
Int64Index: 251 entries, 0 to 250
Columns: 257 entries, 0 to Volume
dtypes: float64(257)
In the first case we got a 251x6 array, but in the latter we get a 251x257 array. It seems there's a transpose in the logic for DatetimeIndices that is not present for other indices.
Metadata
Metadata
Assignees
Labels
No labels