【发布时间】:2023-02-07 18:40:44
【问题描述】:
我有一个 excel 文件,它在单独的列中包含日期和时间数据。他们的类型是熊猫核心系列。 我需要将这两列合并为一列以便进行进一步分析。
如何以正确的方式组合这些列?
我尝试使用 pandas.to_datetime() 函数将它们组合起来,但出现错误:
In: df['dt'] = pd.to_datetime(df['Date']+df['Time'])
Out: TypeError: unsupported operand type(s) for +: 'Timestamp' and 'datetime.time'
【问题讨论】:
标签: python pandas dataframe datetime timestamp