Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我正在尝试将 pd 数据框中的一个字段转换为日期,该字段是日期但格式为 YYYYMMDD
我努力了
pd.to_datetime('20180331').strftime('%Y:%m:%d')
但它不适用于全系列数据,仅适用于一种情况,我有 500.000 行数据集,因此 lambda 函数不会那么快。
谢谢您的帮助
假设您的专栏是 df['col']:
pd.to_datetime(df['col'], format = '%Y%m%d')
文件