New submission from seeking.that <seeking.t...@gmail.com>:
Hi python pandas bdate_range tz_convert() seems to have problems as it prints the information incorrectly. Please clarity. The python script and the output is shown below: Two issues that can be highlighted here are: 1) Setting the timezone correctly to US/Pacific prints the dates correctly. But the conversion causes the date calculations to be incorrect. 2. Minor issue just related to display. Though the API hasn't changed, the last call has more information hh-mm-ss-xx-xx which is not there for the rest of the calls with same format signature. Thanks SK import pandas as pd c5 = pd.bdate_range(start='1/1/2018', end = '1/31/2018') print(c5) c5 = c5.tz_localize('UTC') print(c5) c5 = c5.tz_convert('US/Pacific') print(c5) c6 = pd.bdate_range(start='1/1/2018', end = '1/31/2018') print(c6) c6 = c6.tz_localize('US/Pacific') print(c6) ------ DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-08', '2018-01-09', '2018-01-10', '2018-01-11', '2018-01-12', '2018-01-15', '2018-01-16', '2018-01-17', '2018-01-18', '2018-01-19', '2018-01-22', '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-26', '2018-01-29', '2018-01-30', '2018-01-31'], dtype='datetime64[ns]', freq='B') DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-08', '2018-01-09', '2018-01-10', '2018-01-11', '2018-01-12', '2018-01-15', '2018-01-16', '2018-01-17', '2018-01-18', '2018-01-19', '2018-01-22', '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-26', '2018-01-29', '2018-01-30', '2018-01-31'], dtype='datetime64[ns, UTC]', freq='B') DatetimeIndex(['2017-12-31', '2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-07', '2018-01-08', '2018-01-09', '2018-01-10', '2018-01-11', '2018-01-14', '2018-01-15', '2018-01-16', '2018-01-17', '2018-01-18', '2018-01-21', '2018-01-22', '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-28', '2018-01-29', '2018-01-30'], dtype='datetime64[ns, US/Pacific]', freq='B') DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-08', '2018-01-09', '2018-01-10', '2018-01-11', '2018-01-12', '2018-01-15', '2018-01-16', '2018-01-17', '2018-01-18', '2018-01-19', '2018-01-22', '2018-01-23', '2018-01-24', '2018-01-25', '2018-01-26', '2018-01-29', '2018-01-30', '2018-01-31'], dtype='datetime64[ns]', freq='B') DatetimeIndex(['2018-01-01 00:00:00-08:00', '2018-01-02 00:00:00-08:00', '2018-01-03 00:00:00-08:00', '2018-01-04 00:00:00-08:00', '2018-01-05 00:00:00-08:00', '2018-01-08 00:00:00-08:00', '2018-01-09 00:00:00-08:00', '2018-01-10 00:00:00-08:00', '2018-01-11 00:00:00-08:00', '2018-01-12 00:00:00-08:00', '2018-01-15 00:00:00-08:00', '2018-01-16 00:00:00-08:00', '2018-01-17 00:00:00-08:00', '2018-01-18 00:00:00-08:00', '2018-01-19 00:00:00-08:00', '2018-01-22 00:00:00-08:00', '2018-01-23 00:00:00-08:00', '2018-01-24 00:00:00-08:00', '2018-01-25 00:00:00-08:00', '2018-01-26 00:00:00-08:00', '2018-01-29 00:00:00-08:00', '2018-01-30 00:00:00-08:00', '2018-01-31 00:00:00-08:00'], dtype='datetime64[ns, US/Pacific]', freq='B') ---------- messages: 359156 nosy: Seeking.that priority: normal severity: normal status: open title: pandas tz_convert() seems to report incorrect date conversion versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39179> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com