-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Datetime.index.date returns incorrect date post upgrade to version 0.23 #21230
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
Looks like a timezone issue since this works correctly without a timezone dtype. Investigation and PR's welcome!
|
Hmm is this possibly on purpose?
Prints <class 'pandas.core.indexes.datetimes.DatetimeIndex'> Looking at the index method of DatetimeIndex :
So here the datetime.date obj is intentionally being returned without the timezone information. |
I suppose this is due to #18163, which improved the performance of the Before it relied on the
|
cc @tmnhat2001 welcome to take a look if you would have time. |
Just did a some more digging why some test cases fail. It seems that when
|
…andas-dev#21281) * BUG: Using DatetimeIndex.date with timezone returns incorrect date pandas-dev#21230 * Fix bug where DTI.time returns a tz-aware Time instead of tz-naive pandas-dev#21267 (cherry picked from commit a363e1a)
…andas-dev#21281) * BUG: Using DatetimeIndex.date with timezone returns incorrect date pandas-dev#21230 * Fix bug where DTI.time returns a tz-aware Time instead of tz-naive pandas-dev#21267
Code Sample, a copy-pastable example if possible
the above code prints:
[datetime.date(2013, 1, 23) datetime.date(2013, 1, 24)]
Problem description
Datetime.index.date does return incorrect dates. The behavious worked until version 0.22, and seems to be incorrect post upgrade to version 0.23
Expected Output
[datetime.date(2013, 1, 24) datetime.date(2013, 1, 25)]
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.0
pytest: 3.5.1
pip: 10.0.1
setuptools: 39.1.0
Cython: None
numpy: 1.12.1
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: 1.7.4
patsy: 0.5.0
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: