Skip to content

BUG: Inconsistent conversion of to_datetime #36190

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
2 of 3 tasks
JulianWgs opened this issue Sep 7, 2020 · 2 comments
Closed
2 of 3 tasks

BUG: Inconsistent conversion of to_datetime #36190

JulianWgs opened this issue Sep 7, 2020 · 2 comments
Labels
Datetime Datetime data dtype Duplicate Report Duplicate issue or pull request

Comments

@JulianWgs
Copy link

  • I have checked that this issue has not already been reported.
    I've looked through all issues regarding to_datetime, but I could've missed something.
  • 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.

Code Sample, a copy-pastable example

pd.to_datetime(["13.12.2020", "12.13.2020"])
# DatetimeIndex(['2020-12-13', '2020-12-13'], dtype='datetime64[ns]', freq=None)

Problem description

Two different inputs produce the same result. The reason is that the function uses a different format for different entries. I don't know what the usecase of this is, but usually all the data has the same format. The error also passes silently.

Expected Output

Either an error that something is wrong with the hint to use days_first=True or detect the format for all values and apply it.

I'm aware that the format can't always be determined, but it is possible to detect if something is wrong.

Output of pd.show_versions()

INSTALLED VERSIONS

commit : f2ca0a2
python : 3.8.3.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.18362
machine : AMD64
processor : Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : de_DE.cp1252

pandas : 1.1.1
numpy : 1.18.5
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 47.3.1.post20200622
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.5.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.16.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : 0.7.4
fastparquet : None
gcsfs : None
matplotlib : 3.3.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.17.1
pytables : None
pyxlsb : None
s3fs : 0.4.2
scipy : 1.3.2
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 1.2.0
xlwt : None
numba : 0.48.0

@JulianWgs JulianWgs added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 7, 2020
@jreback
Copy link
Contributor

jreback commented Sep 7, 2020

duplicate of #12585

a pull request to patch would be welcome

@jreback jreback added Duplicate Report Duplicate issue or pull request Datetime Datetime data dtype and removed Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 7, 2020
@jreback jreback added this to the No action milestone Sep 7, 2020
@jreback jreback closed this as completed Sep 7, 2020
@JulianWgs
Copy link
Author

Sorry, I missed that. Thank you for the fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Datetime Datetime data dtype Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

No branches or pull requests

2 participants