Skip to content

BUG: reindex by both index and columns loses DatetimeIndex frequency #3317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
joeb1415 opened this issue Apr 11, 2013 · 6 comments
Closed

BUG: reindex by both index and columns loses DatetimeIndex frequency #3317

joeb1415 opened this issue Apr 11, 2013 · 6 comments
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@joeb1415
Copy link

Given:

from numpy import ones
from pandas import DataFrame, __version__
df = DataFrame(ones((3, 3)), index=[datetime(2012, 1, 1), datetime(2012, 1, 2), datetime(2012, 1, 3)], columns=['a', 'b', 'c'])

time_freq = date_range('2012-01-01', '2012-01-03', freq='d')
some_cols = ['a', 'b']

We get:

__version__

'0.10.1'

df.reindex(index=time_freq).index.freq

<1 Day>

df.reindex(index=time_freq, columns=some_cols).index.freq

None

df.reindex(index=time_freq).reindex(columns=some_cols).index.freq

<1 Day>

@joeb1415
Copy link
Author

still present in 0.11.0

@cpcloud
Copy link
Member

cpcloud commented Jun 22, 2013

this is a bug with equality testing for DatetimeIndexes, freq property wasn't being compared, pr coming in the next few minutes

@cpcloud
Copy link
Member

cpcloud commented Jun 22, 2013

unless of course this breaks a bunch of things then more discussion may be needed

@cpcloud
Copy link
Member

cpcloud commented Jun 22, 2013

and of course it breaks 21 tests in the tseries module....@jreback @wesm should DatetimeIndexes with different frequencies compare unequal? it would seem that a lot of code depends on that not being the case...

@wesm
Copy link
Member

wesm commented Jun 23, 2013

I don't think so, index.equals(other_index) should be true if the data is the same. we should preserve metadata wherever possible though

@jreback
Copy link
Contributor

jreback commented Aug 21, 2013

closed by #4610

@jreback jreback closed this as completed Aug 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

No branches or pull requests

4 participants