Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x gmt的时间数据与转换的格式输入不匹配_Python 3.x_Pandas_Datetime_Formatting_Valueerror - Fatal编程技术网

Python 3.x gmt的时间数据与转换的格式输入不匹配

Python 3.x gmt的时间数据与转换的格式输入不匹配,python-3.x,pandas,datetime,formatting,valueerror,Python 3.x,Pandas,Datetime,Formatting,Valueerror,如何将带有GMT的日期时间字符串转换为熊猫日期时间格式 以下是一个例子: #date_time is like 12/Dec/2015:18:25:11 +0100 df['date_time'] = pd.to_datetime(df['date_time'], format="%d/%b/%Y:%I:%M:%S %Z") 以下是错误: ValueError:时间数据“12/Dec/2015:18:25:11+0100”不匹配 格式“%d/%b/%Y:%I:%M:%S%Z”(匹配) 您最好检

如何将带有GMT的日期时间字符串转换为熊猫日期时间格式

以下是一个例子:

#date_time is like 12/Dec/2015:18:25:11 +0100
df['date_time'] = pd.to_datetime(df['date_time'], format="%d/%b/%Y:%I:%M:%S %Z")
以下是错误:

ValueError:时间数据“12/Dec/2015:18:25:11+0100”不匹配 格式“%d/%b/%Y:%I:%M:%S%Z”(匹配)


您最好检查格式化的字符串:


使用
'%d/%b/%Y:%H:%M:%S%z'
代替
'%d/%b/%Y:%I:%M:%S%z'
,谢谢,我没有错误。但是它是超长的,你知道一种更快的解析方法吗?