简体   繁体   English

TypeError: import_optional_dependency() 得到了一个意外的关键字参数 'errors'

[英]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.

相关问题 LDA 可视化 [import_optional_dependency() 得到了一个意外的关键字参数“错误”] - LDA visualization [ import_optional_dependency() got an unexpected keyword argument 'errors' ] TypeError:得到一个意外的关键字参数 - TypeError: got an unexpected keyword argument 类型错误:function() 得到了一个意外的关键字参数“njobs” - TypeError: function() got an unexpected keyword argument 'njobs' 类型错误:_log() 得到了意外的关键字参数“stacklevel” - TypeError: _log() got an unexpected keyword argument 'stacklevel' 类型错误:有一个意外的关键字参数“条目” - TypeError: got an unexpected keyword argument 'entry' TypeError:editProfile()得到了意外的关键字参数“ obj” - TypeError: editProfile() got an unexpected keyword argument 'obj' 类型错误:启动()有一个意外的关键字参数“超时” - TypeError: initiate() got an unexpected keyword argument 'timeout' 类型错误:tensor() 得到了一个意外的关键字参数“名称” - TypeError: tensor() got an unexpected keyword argument 'names' TypeError:recv()获得了意外的关键字参数“ dest” - TypeError: recv() got an unexpected keyword argument 'dest' 类型错误:videoResponsive() 得到了一个意外的关键字参数“宽度” - TypeError: videoResponsive() got an unexpected keyword argument 'width'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM