I am trying to work with Featuretools to develop an automated feature engineering workflow for the customer churn dataset. 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.
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' ". Please help resolve this 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
:
pip install pandas --upgrade
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With