码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-09-17 19:55:59      阅读:2571      评论:0      收藏:0      [点我收藏+]

标签:and   code   series   日期格   http   tail   博客   time   参考   

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

标签:and   code   series   日期格   http   tail   博客   time   参考   

原文地址:https://www.cnblogs.com/Rvin/p/9663377.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!