Series object has no attribute clip_upper

Viewed 1906

Although i have updated my pandas package still getting the same error. Can any one help me out?


AttributeError                            Traceback (most recent call last)
<ipython-input-11-15edd19aa9dd> in <module>
----> 1 telco=telco_numvar.apply(lambda x:outlier_capping(x))

E:\anacondapath\lib\site-packages\pandas\core\frame.py in apply(self, func, axis, raw, result_type, args, **kwds)
   7539             kwds=kwds,
   7540         )
-> 7541         return op.get_result()
   7542 
   7543     def applymap(self, func) -> "DataFrame":

E:\anacondapath\lib\site-packages\pandas\core\apply.py in get_result(self)
    178             return self.apply_raw()
    179 
--> 180         return self.apply_standard()
    181 
    182     def apply_empty_result(self):

E:\anacondapath\lib\site-packages\pandas\core\apply.py in apply_standard(self)
    253 
    254     def apply_standard(self):
--> 255         results, res_index = self.apply_series_generator()
    256 
    257         # wrap results

E:\anacondapath\lib\site-packages\pandas\core\apply.py in apply_series_generator(self)
    282                 for i, v in enumerate(series_gen):
    283                     # ignore SettingWithCopy here in case the user mutates
--> 284                     results[i] = self.f(v)
    285                     if isinstance(results[i], ABCSeries):
    286                         # If we have a view on v, we need to make a copy because

<ipython-input-11-15edd19aa9dd> in <lambda>(x)
----> 1 telco=telco_numvar.apply(lambda x:outlier_capping(x))

<ipython-input-9-df1facca9fe7> in outlier_capping(x)
      1 # outlier treatment
      2 def outlier_capping(x):
----> 3     x=x.clip_upper(x.quantile(0.99))
      4     x=x.clip_lower(x.quantile(0.01))
      5     return x

E:\anacondapath\lib\site-packages\pandas\core\generic.py in __getattr__(self, name)
   5128             if self._info_axis._can_hold_identifiers_and_holds_name(name):
   5129                 return self[name]
-> 5130             return object.__getattribute__(self, name)
   5131 
   5132     def __setattr__(self, name: str, value) -> None:

AttributeError: 'Series' object has no attribute 'clip_upper'
1 Answers

Use clip(upper=limit) Check out this link

Related