我是一个python新手,正在尝试跟随这个关于寻找季节性客户的伟大博客:
Python Code for Identifying Seasonal Customers
然而,我被困在最后一步。代码如下:
customerTS = stats.ts(dataForOwner.SENDS.astype(int),
start=base.c(startYear,startMonth),
end=base.c(endYear, endMonth),
frequency=12)
我得到这个错误:NameError: name 'dataForOwner' is not defined
编辑我应该补充最后一行也在代码块中,但是我仍然得到错误,没有包括:
customerTS = stats.ts(dataForOwner.SENDS.astype(int),
start=base.c(startYear,startMonth),
end=base.c(endYear, endMonth),
frequency=12)
r.assign('customerTS', customerTS)
我在google上搜索了很多次,但都没有成功。你知道吗
是由Python自身引发的,表示它无法在当前上下文中找到名为
dataForOWner
的对象。要亲自体验一下,只需启动一个新的Python终端并键入x
(一个不存在的变量名)。你知道吗问题要么在于你引用的博客(缺少
dataForOwner
的定义),要么在于试图复制该博客的用户忘记了该定义。你知道吗相关问题 更多 >
编程相关推荐