-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: bad directive in to_datetime format - this uses std. strptime zone offset #13486
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
Comments
Timezones Two possible workarounds (without parsing the date in two parts, the offset separately):
Both methods you could apply on the values in your datetime column. But that will not necessarily be faster than parsing the timezone offset separately (if performance is a bottleneck) See also http://stackoverflow.com/questions/1101508/how-to-parse-dates-with-0400-timezone-string-in-python |
actually I don't think this would be very hard to add here (and should have the single whitespace be optional) its a pretty regular regex, and we could just be passed in directly as the |
@jorisvandenbossche thanks for the great advice! Obviously the python 2 docu is wrong since %z is actually not supported. I learned a lot! At least for now I go with the dateutil workaround. |
pandas DOES implement the strptime format parsing, the |
this is really bad for me since almost all linux logfiles contain zone offset.
As far as I can see there is not workaround without parsing the timestamp twice.
Code Sample, a copy-pastable example if possible
parse common Apache access log timestamp
Expected Output
should parse timestamps with zone offset
output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-24-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
pandas: 0.17.1
nose: 1.3.7
pip: 8.1.2
setuptools: 23.0.0
Cython: None
numpy: 1.11.0
scipy: 0.17.0
statsmodels: 0.6.1
IPython: 4.2.0
sphinx: 1.3.6
patsy: 0.4.1
dateutil: 2.4.2
pytz: 2014.10
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.3
matplotlib: 1.5.1
openpyxl: 2.3.0
xlrd: 0.9.4
xlwt: 0.7.5
xlsxwriter: None
lxml: 3.5.0
bs4: 4.4.1
html5lib: 0.999
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
Jinja2: None
The text was updated successfully, but these errors were encountered: