Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
import pandas as pd
from datetime import timedelta as td
test_ts = pd.Timestamp('2020-11-02 05:00:01.167', tz='UTC')
lt_ts = test_ts.tz_convert('America/New_York')
lt_ts
# Timestamp('2020-11-02 00:00:01.167000-0500', tz='America/New_York')
lt_ts -= td(days=1)
lt_ts
# Timestamp('2020-11-01 01:00:01.167000-0400', tz='America/New_York')
lt_ts.round(freq='H')
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "pandas/_libs/tslibs/timestamps.pyx", line 1145, in pandas._libs.tslibs.timestamps.Timestamp.round
File "pandas/_libs/tslibs/timestamps.pyx", line 1099, in pandas._libs.tslibs.timestamps.Timestamp._round
File "pandas/_libs/tslibs/timestamps.pyx", line 1317, in pandas._libs.tslibs.timestamps.Timestamp.tz_localize
File "pandas/_libs/tslibs/tzconversion.pyx", line 63, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc_single
File "pandas/_libs/tslibs/tzconversion.pyx", line 275, in pandas._libs.tslibs.tzconversion.tz_localize_to_utc
pytz.exceptions.AmbiguousTimeError: Cannot infer dst time from 2020-11-01 01:00:00, try using the 'ambiguous' argument
Problem description
pandas.Timestamp.round method crashes.
Expected Output
Timestamp('2020-11-01 01:00:00.0000-0400', tz='America/New_York')
Output of pd.show_versions()
pd.show_versions()
INSTALLED VERSIONS
commit : 67a3d42
python : 3.8.5.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-52-generic
Version : #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 1.1.4
numpy : 1.19.2
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 50.3.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.3 (dt dec pq3 ext lo64)
jinja2 : 2.11.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None