小编Sac*_*ani的帖子

类型错误:需要一个整数(得到类型时间戳)

我有以下格式的 Excel 表格:

在此处输入图片说明

我想使用pandas模块使用 Python 读取此表并计算发布日期和当前日期之间的差异。这是我当前的代码:

    import pandas as pd
    import datetime as dt
    def abc():
        a=pd.read_excel('date time.xlsx')
        b=dt.date.today()
        print(b)
        c=(a['date of issue'])
        h=(c[0])
        f=dt.datetime(h)
        d=b-f
        print(d)
   abc()
Run Code Online (Sandbox Code Playgroud)

它在第 7 行 ( f=dt.datetime(h)) 中显示错误。它读TypeError: an integer is required (got type Timestamp)

python python-3.x python-datetime pandas

6
推荐指数
1
解决办法
8052
查看次数

标签 统计

pandas ×1

python ×1

python-3.x ×1

python-datetime ×1