Skip to content
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

BUG: DatetimeIndex uses the wrong union if the operands overlap #4564

Merged
merged 1 commit into from Sep 26, 2013

Conversation

@filmor
Copy link
Contributor

commented Aug 15, 2013

This pretty much boils down to this line: https://github.com/pydata/pandas/blob/master/pandas/tseries/index.py#L987

You can easily reproduce the error using the following code:

r = pd.date_range("2013-01-01", "2013-02-01")
r2 = r + pd.DateOffset(minutes=15)
r | r2 # Results in the index r having "2013-01-31 00:15" appended

This happens because the check on the given line does not take into account, that two indices with the same offset do not necessarily have to be aligned. If they are the _fast_union-method can be used, if not it should fall back to the Index implementation.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Aug 14, 2013

seems easy enough.....PR ?

@filmor

This comment has been minimized.

Copy link
Contributor Author

commented Aug 15, 2013

I'm really sorry for the noise here ...
Travis seems to be angry with me for doing so, but locally all tests run successfully.

@jreback

This comment has been minimized.

Copy link
Contributor

commented Aug 23, 2013

can you hook up travis?

@filmor

This comment has been minimized.

Copy link
Contributor Author

commented Sep 23, 2013

Travis seems to work now, the latest commit is already rebased to master.

Fixes wrong overlapping check in _can_fast_union.
To use the fast_union method it is not enough to find an overlap, the
indices also have to be aligned.

@jreback jreback merged commit 3584e50 into pandas-dev:master Sep 26, 2013

@jreback

This comment has been minimized.

Copy link
Contributor

commented Sep 26, 2013

@filmor thanks!

@filmor filmor deleted the filmor:dt_index_fix branch Jan 6, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.