BUG: DatetimeIndex uses the wrong union if the operands overlap by filmor · Pull Request #4564 · pandas-dev/pandas (original) (raw)

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.