我尝试在 fillna 中使用 math.sin() 函数,但失败了:
data['Sensor #1'].fillna(math.sin(data["Sample #"] * parameter), inplace = True)
有什么办法可以解决吗?
这是错误消息:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-145-9199336c2860> in <module>()
11
12
---> 13 data['Sensor #1'].fillna(math.sin(data["Sample #"] * parameter), inplace = True)
14 data['Sensor #2'].fillna(lambda r: r["Sample #"]**-parameter, inplace = True)
15 # drop the row that has empty value(s) because we want to find anomalies
/anaconda3/lib/python3.6/site-packages/pandas/core/series.py in wrapper(self)
115 return converter(self.iloc[0])
116 raise TypeError("cannot convert the series to "
--> 117 "{0}".format(str(converter)))
118
119 return wrapper
TypeError: cannot convert the series to <class 'float'>