-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DatetimeIndex union fails in 0.19rc1 when constructed from differences in DatetimeIndexes #14323
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
Comments
@Liam3851 Thanks for the report! I can confirm it is indeed a bug/regression. Seems it has something to do with
vs
|
It looks to me like this was introduced with #13514.
Before, this code returned a new DatetimeIndex:
I'm not too familiar with this code, but it looks to me like _shallow_copy is copying all the attributes, including the freq (which is no longer valid after the differencing operation). The |
@Liam3851 I think that is a perfect assessment of the situation. We could use @sinhrks do you think of a generic approach without adding code to specifically invalidate the |
you can just pass freq=None to _shallow_copy |
Ah, I thought that would not work for PeriodIndex (which wants to keep its @Liam3851 Wants to do a PR for this change? |
I'm doing a PR (sorry, still a newb at Git and pandas building). Just want to get the requirements straight for the unit tests:
That about right? |
… incorrect closes pandas-dev#14323 Sets freq to None when doing a difference operation on a DatetimeIndex or TimedeltaIndex, rather than retaining the frequency (which can cause problems with downstream operations). Frequency of PeriodIndex is retained. Author: David Krych <[email protected]> Closes pandas-dev#14346 from Liam3851/dtind_diff_14323 and squashes the following commits: 1dbf582 [David Krych] BUG: GH14323 Union of differences from DatetimeIndex incorrect (cherry picked from commit bee90a7)
When constructing a union of 2 DatetimeIndex objects that themselves were constructed from differences from a third DatetimeIndex, the union operator is ignored. This appears to be new behavior in 0.19rc1; the code functioned correctly under 0.18.1.
Output of
pd.show_versions()
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 62 Stepping 4, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.19.0rc1+0.g497a3bc.dirty
nose: 1.3.7
pip: 8.1.2
setuptools: 27.2.0
Cython: 0.24.1
numpy: 1.11.1
scipy: 0.18.1
statsmodels: 0.6.1
xarray: 0.8.2
IPython: 5.1.0
sphinx: 1.4.6
patsy: 0.4.1
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: 1.1.0
tables: 3.2.2
numexpr: 2.6.1
matplotlib: 1.5.3
openpyxl: 2.3.2
xlrd: 1.0.0
xlwt: 1.1.2
xlsxwriter: 0.9.3
lxml: 3.6.4
bs4: 4.5.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.4.2
sqlalchemy: 1.0.13
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.42.0
pandas_datareader: 0.2.1
The text was updated successfully, but these errors were encountered: