Description
Code Sample
import datetime
datetime.datetime(1953,1,23,0).astimezone(datetime.timezone(datetime.timedelta(days=-1, seconds=57600), 'Pacific Standard Time'))
Problem description
pandas._libs.tslibs.tzconversion._tz_convert_tzlocal_utc
calls dt.astimezone()
, which fails on Windows for pre-Epoch datetimes (see, e.g., code sample above) with OSError: [Errno 22] Invalid argument.
This appears to be related to this issue dateutil/dateutil#197, where time.localtime() can't take negative values on Windows.
Output of pd.show_versions()
pandas : 0.25.3
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0.post20200210
Cython : None
pytest : None
hypothesis : None
sphinx : 2.4.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.4.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.9.0
pandas_datareader: None
bs4 : 4.8.1
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : 3.0.0
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.2
sqlalchemy : None
tables : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
Edit
The error appears to be in the datetutil module, not directly in datetime. See the stacktrace below: