[英]TypeError: import_optional_dependency() got an unexpected keyword argument 'errors'
I am trying to work with Featuretools to develop an automated feature engineering workflow for the customer churn dataset.我正在尝试与 Featuretools 合作,为客户流失数据集开发一个自动化的特征工程工作流。 The end outcome is a function that takes in a dataset and label times for customers and builds a feature matrix that can be used to train a machine learning model.
最终结果是 function,它为客户接收数据集和 label 次,并构建可用于训练机器学习 model 的特征矩阵。
As part of this exercise I am trying to execute the below code for plotting a histogram and got " TypeError: import_optional_dependency() got an unexpected keyword argument 'errors' ".作为本练习的一部分,我尝试执行以下代码来绘制直方图并得到“ TypeError: import_optional_dependency() got an unexpected keyword argument 'errors' ”。 Please help resolve this TypeError.
请帮助解决此 TypeError。
import matplotlib.pyplot as plt
%matplotlib inline
plt.style.use('fivethirtyeight')
plt.rcParams['figure.figsize'] = (10, 6)
trans.loc[trans['actual_amount_paid'] < 250, 'actual_amount_paid'].dropna().plot.hist(bins = 30)
plt.title('Distribution of Actual Amount Paid')
Below is the full error I received:以下是我收到的完整错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-32-7e19affd5fc1> in <module>
4 plt.rcParams['figure.figsize'] = (10, 6)
5
----> 6 trans.loc[trans['actual_amount_paid'] < 250, 'actual_amount_paid'].dropna().plot.hist(bins = 30)
7 plt.title('Distribution of Actual Amount Paid')
~\anaconda3\lib\site-packages\pandas\core\ops\common.py in new_method(self, other)
63 break
64 if isinstance(other, cls):
---> 65 return NotImplemented
66
67 other = item_from_zerodim(other)
~\anaconda3\lib\site-packages\pandas\core\arraylike.py in __lt__(self, other)
35 def __ne__(self, other):
36 return self._cmp_method(other, operator.ne)
---> 37
38 @unpack_zerodim_and_defer("__lt__")
39 def __lt__(self, other):
~\anaconda3\lib\site-packages\pandas\core\series.py in _cmp_method(self, other, op)
4937 --------
4938 >>> s = pd.Series(range(3))
-> 4939 >>> s.memory_usage()
4940 152
4941
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in comparison_op(left, right, op)
248 lvalues = ensure_wrapped_if_datetimelike(left)
249 rvalues = ensure_wrapped_if_datetimelike(right)
--> 250
251 rvalues = lib.item_from_zerodim(rvalues)
252 if isinstance(rvalues, list):
~\anaconda3\lib\site-packages\pandas\core\ops\array_ops.py in _na_arithmetic_op(left, right, op, is_cmp)
137
138 def _na_arithmetic_op(left, right, op, is_cmp: bool = False):
--> 139
140 Return the result of evaluating op on the passed in values.
141
~\anaconda3\lib\site-packages\pandas\core\computation\expressions.py in <module>
17 from pandas._typing import FuncType
18
---> 19 from pandas.core.computation.check import NUMEXPR_INSTALLED
20 from pandas.core.ops import roperator
21
~\anaconda3\lib\site-packages\pandas\core\computation\check.py in <module>
1 from pandas.compat._optional import import_optional_dependency
2
----> 3 ne = import_optional_dependency("numexpr", errors="warn")
4 NUMEXPR_INSTALLED = ne is not None
5 if NUMEXPR_INSTALLED:
TypeError: import_optional_dependency() got an unexpected keyword argument 'errors'
Try to upgrade pandas
:尝试升级
pandas
:
pip install pandas --upgrade
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.