我有一个简码如下。尝试使用.apply
来调用一个函数。但它总是给我一个错误,说该函数不可调用。
def awesome_count():
return 10
products['awesome'] = products['word_count'].apply(awesome_count())
AssertionError Traceback (most recent call last)
<ipython-input-45-493b4bfe94cc> in <module>()
----> 1 products['awesome'] = products['word_count'].apply(awesome_count())
C:\Users\twu\AppData\Local\Dato\Dato Launcher\lib\site-packages\graphlab\data_structures\sarray.pyc in apply(self, fn, dtype, skip_undefined, seed)
1598 [0.0, 1.0, 2.0]
1599 """
-> 1600 assert callable(fn), "Input function must be callable."
1601
1602 dryrun = [fn(i) for i in self.head(100) if i is not None]
AssertionError: Input function must be callable.
有人可以帮帮我吗?