pandas格式化str为时间,pandas将int转化为str

Posted rvin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pandas格式化str为时间,pandas将int转化为str相关的知识,希望对你有一定的参考价值。

code_300[‘HISTORY_DATE‘] = code_300[‘HISTORY_DATE‘].map(str)
code_300[‘HISTORY_DATE‘] = pd.to_datetime(code_300[‘HISTORY_DATE‘], format=‘%Y-%m-%d‘)

1.map函数可以为series所用,pandas可以用applymap函数适用于整个pandas,博客参考:https://blog.csdn.net/u010814042/article/details/76401133/
2.to_datetime函数可以将pandas的20180902这种直接格式化为日期格式,博客参考:https://blog.csdn.net/mhywoniu/article/details/78513935



以上是关于pandas格式化str为时间,pandas将int转化为str的主要内容,如果未能解决你的问题,请参考以下文章