-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: DatetimeIndex.time incorrect in case of timezones #21267
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
Agreed, the docs should be changed to indicate that |
@ssikdar1 @mroeschke I am sorry but I couldn't recreate the output that your code showed. Is it possible that it is an OS based feature? (mine is Windows) Any other method by which that output could be achieved? |
What version of pandas are you using @uds5501? I don't believe this should be OS specific, and I can confirm this on the latest release.
|
So it works for pandas 0.22.0, is it possible then its a bug from 22->23?
|
So it appears this behavior changed after #18461. However IMO, I would consider this an coincidental enhancement instead of a regression (the time is still correct and now gained timezone information). Thoughts @jorisvandenbossche? |
I actuallly get a different output as you: with a timezone (so changed from 0.22), but also the wrong hour (similar actually as in the top post):
so this is clearly a regression. The fact that it is working correctly for you and not for me is strange .. What is the locale on your system? (in case it depends on that) |
Oops sorry. You're absolutely correct @jorisvandenbossche. Not sure what I was looking at but I am getting the same results as you now. |
@mroeschke I am using '0.21.1' |
@jorisvandenbossche so this is actually correct
But this confusion stems from this construction bug in #15938 (I believe) |
Ah, yes, sorry, missed this comment. It's indeed the construction that is confusing here! |
…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
An offshoot of #21230
http://pandas.pydata.org/pandas-docs/stable/timeseries.html?highlight=weekofmonth#time-date-components
From the docs:
There are several time/date properties that one can access from Timestamp or a collection of timestamps like a DatetimeIndex.
...
time | Returns datetime.time (does not contain timezone information)
But take this code here:
returns:
This may not be a bad thing, but if tz information is expected the docs should probably be changed?
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Linux
OS-release: 4.13.0-43-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.0
pytest: None
pip: 9.0.1
setuptools: 28.8.0
Cython: None
numpy: 1.14.3
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: