TypeError: unsupported operand type(s) for +: 'getset_descriptor' and 'int'

Traceback (most recent call last):
  File "C:\Users\Administrator\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-4b80bb28613a>", line 1, in <module>
    runfile('D:/Python/Learning/pandasLearn.py', wdir='D:/Python/Learning')
  File "C:\Program Files\JetBrains\PyCharm 2019.3.2\plugins\python\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm 2019.3.2\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/Python/Learning/pandasLearn.py", line 42, in <module>
    test['D'].at[i] = add_month(start, i)
  File "D:/Python/Learning/pandasLearn.py", line 32, in add_month
    return date(date.year + year, month, date.day)
TypeError: unsupported operand type(s) for +: 'getset_descriptor' and 'int'

我这个错误其实错的也很明显了,TypeError说不支持操作类型'getset_descriptor' and 'int'相加,在这里插入图片描述
我这个date.year是getset_descriptor类型,第二个year是int类型,所以两个不能相加,我把变量名字看错了,只需改成正确的int类型就可以正常运行了:
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bean冷的心

你的鼓励将是我前进的动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值