-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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: guess_datetime_format
appears to be returning incomplete formats
#52418
Labels
Comments
galipremsagar
added
Bug
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Apr 4, 2023
mroeschke
added
Enhancement
Datetime
Datetime data dtype
and removed
Bug
Needs Triage
Issue that has not been reviewed by a pandas team member
labels
Apr 4, 2023
I don't think |
I don't think Python allows for In [10]: datetime.strptime('2019-07-16 00:00:00.333333', '%Y-%m-%d %H:%M:%S.%6f')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In [10], line 1
----> 1 datetime.strptime('2019-07-16 00:00:00.333333', '%Y-%m-%d %H:%M:%S.%6f')
File /usr/lib/python3.8/_strptime.py:568, in _strptime_datetime(cls, data_string, format)
565 def _strptime_datetime(cls, data_string, format="%a %b %d %H:%M:%S %Y"):
566 """Return a class cls instance based on the input string and the
567 format string."""
--> 568 tt, fraction, gmtoff_fraction = _strptime(data_string, format)
569 tzname, gmtoff = tt[-2:]
570 args = tt[:6] + (fraction,)
File /usr/lib/python3.8/_strptime.py:341, in _strptime(data_string, format)
339 bad_directive = "%"
340 del err
--> 341 raise ValueError("'%s' is a bad directive in format '%s'" %
342 (bad_directive, format)) from None
343 # IndexError only occurs when the format string is "%"
344 except IndexError:
ValueError: '6' is a bad directive in format '%Y-%m-%d %H:%M:%S.%6f' |
3 tasks
Yeah it appears that C++ can accept digits corresponding to microseconds which this method isn't intended to support, so closing as wont fix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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 number of digits in the sub-second data appears to be missing. Ideally the format I was looking for was
%Y-%m-%d %H:%M:%S.%9f'
Expected Behavior
Installed Versions
INSTALLED VERSIONS
commit : c2a7f1a
python : 3.10.10.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-76-generic
Version : #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.0.0rc1
numpy : 1.23.5
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.6.1
pip : 23.0.1
Cython : 0.29.33
pytest : 7.2.2
hypothesis : 6.70.1
sphinx : 5.3.0
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.12.0
pandas_datareader: None
bs4 : 4.12.0
bottleneck : None
brotli :
fastparquet : None
fsspec : 2023.3.0
gcsfs : None
matplotlib : None
numba : 0.56.4
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 11.0.0
pyreadstat : None
pyxlsb : None
s3fs : 2023.3.0
scipy : 1.10.1
snappy :
sqlalchemy : 1.4.46
tables : None
tabulate : 0.9.0
xarray : None
xlrd : None
zstandard : None
tzdata : 2023.3
qtpy : None
pyqt5 : None
The text was updated successfully, but these errors were encountered: