-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
BUG: to_datetime() with errors='coerce' raises AttributeError on MacOS #54479
Comments
take |
Hey @nhoover, just checked the issue, the third case is also converting to NaT without throwing any exception. I am using the latest version of pandas and it isn't occurring there. Also, I tried it in an online compiler and it seemed to return the desired result, i.e., NaT. |
Doesn't reproduce for me either (on WSL2). With 2.0.3 I get On main I get a deprecation warning with the same result as above. |
With 2.0.3 on windows I get different results depending on the input. I never seem to get the Input: Input: The same exception as reported above was also reported here #54481. |
Well it's so hard to reproduce and interesting that the same issue was reported again a few hours after I did. So it's happening for at least 2 people. Running on Windows 10 and Windows 11 with same 3.11.4 python/2.0.3 pandas I get the same as @jenno-verdonck I submitted the issue running on MacOS 13.5 so adjusted the issue title. |
A friend tried this on an M1 Mac and also couldn't reproduce. So maybe it's only on Intel Mac. Mine is a 2019 Mac Book Pro: 2.4 GHz 8-Core Intel Core i9. |
I can't reproduce but, Line 527 in bdb509f
|
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
When converting a date string with to_datetime(errors='coerce') an AttributeError is raised in one case where the input string contains a timezone.
Expected Behavior
In the above examples, the first case '10-3-2014 13:00' is properly converted as '2014-10-03 13:00:00'
The second case '10-3-2014 13:AA' properly converts to 'NaT' with no exception
The third case '10-3-2014 13:00:00 PDT' should either work or convert to NaT - either way no AttributeError should be raised.
Installed Versions
INSTALLED VERSIONS
commit : 0f43794
python : 3.11.4.final.0
python-bits : 64
OS : Darwin
OS-release : 22.6.0
Version : Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.0.3
numpy : 1.25.0
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 65.5.1
pip : 23.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: