Python 类型错误:strptime() 参数 1 必须是字符串,而不是系列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46737330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
TypeError: strptime() argument 1 must be string, not Series
提问by Ashish Choudhary
I am writing a single entry from a column of a data frame
我正在从数据框的列中写入单个条目
2011100101 is interpreted as 1 AM of 1st October 2011.
2011100101 被解释为 2011 年 10 月 1 日凌晨 1 点。
I want it to change in the format as YYYY-Mmm-dd HH
我希望它的格式更改为 YYYY-Mmm-dd HH
train['date1']=datetime.strptime(train['ID'], '%Y%m%d%H')
but getting an error TypeError: strptime() argument 1 must be string, not Series
但得到一个错误 TypeError: strptime() 参数 1 必须是字符串,而不是系列
How to change in the required format for the entire entries in a single column?
如何更改单个列中整个条目所需的格式?