BUG: inconsistent processing of datetime in format '%Y-%m-%dT%H:%M:%S' depending on whether there is a time or it is 00:00:00 #60431
Labels
Arrow
pyarrow functionality
Bug
Closing Candidate
May be closeable, needs more eyeballs
Duplicate Report
Duplicate issue or pull request
IO CSV
read_csv, to_csv
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
The outcome of the above inconsistently removes the "T" from the date format, like so:
0 2023-04-27T10:00:00 2023-04-27 00:00:00
1 2026-08-12T22:00:00 2026-08-13 00:00:00
2 2028-03-23T04:00:00 2028-03-23 00:00:00
3 2022-12-28T12:00:00 2022-12-28 00:00:00
4 2022-02-09T09:33:00 2022-02-09 00:00:00
5 2023-06-21T05:00:00 2023-06-21 00:00:00
6 2024-11-28T03:00:00 2024-11-28 00:00:00
7 2024-03-21T13:00:00 2024-03-21 00:00:00
8 2023-12-01T12:00:00 2023-12-01 00:00:00
9 2024-11-19T09:00:00 2024-10-30 00:00:00
Note above how the "T" remains in the left most column where there are time values, and is removed on the right column where all time values are 00:00:00
This makes it impossible to map the dates consistently with the format '%Y-%m-%dT%H:%M:%S' .
Note this issue requires all values in a column to have time = 00:00:00
Expected Behavior
The two columns should still have the "T" between date and time
Installed Versions
INSTALLED VERSIONS
commit : 0691c5c
python : 3.11.10
python-bits : 64
OS : Linux
OS-release : 6.5.0-1025-azure
Version : #26~22.04.1-Ubuntu SMP Thu Jul 11 22:33:04 UTC 2024
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.2.3
numpy : 2.1.2
pytz : 2024.2
dateutil : 2.9.0.post0
pip : 24.2
Cython : None
sphinx : None
IPython : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2024.10.0
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.4
lxml.etree : 5.3.0
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
psycopg2 : None
pymysql : None
pyarrow : 17.0.0
pyreadstat : None
pytest : 7.4.4
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
xlsxwriter : None
zstandard : None
tzdata : 2024.2
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: