Skip to content

BUG: %Y%m%d format with errors='ignore' doesn't return input #50072

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

Closed
3 tasks done
MarcoGorelli opened this issue Dec 5, 2022 · 1 comment
Closed
3 tasks done

BUG: %Y%m%d format with errors='ignore' doesn't return input #50072

MarcoGorelli opened this issue Dec 5, 2022 · 1 comment
Labels
Bug Datetime Datetime data dtype

Comments

@MarcoGorelli
Copy link
Member

MarcoGorelli commented Dec 5, 2022

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

In [1]: to_datetime('15000101', format='%Y%m%d', errors='ignore')
Out[1]: datetime.datetime(1500, 1, 1, 0, 0)

In [2]: to_datetime('1500-01-01', format='%Y-%m-%d', errors='ignore')
Out[2]: '1500-01-01'

Issue Description

It converted to datetime.datetime instead of returning the input

Expected Behavior

'15000101'

Returning the input is what we do for literally every single other format

Installed Versions

INSTALLED VERSIONS

commit : 8dab54d
python : 3.8.15.final.0
python-bits : 64
OS : Linux
OS-release : 5.10.102.1-microsoft-standard-WSL2
Version : #1 SMP Wed Mar 2 00:30:59 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8

pandas : 1.5.2
numpy : 1.23.5
pytz : 2022.6
dateutil : 2.8.2
setuptools : 65.5.1
pip : 22.3.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 : 8.6.0
pandas_datareader: None
bs4 : 4.11.1
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
xlwt : None
zstandard : None
tzdata : None
None

@MarcoGorelli MarcoGorelli added Bug Needs Triage Issue that has not been reviewed by a pandas team member Datetime Datetime data dtype and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Dec 5, 2022
@MarcoGorelli
Copy link
Member Author

dupe #14487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Datetime Datetime data dtype
Projects
None yet
Development

No branches or pull requests

1 participant