首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >序列对象没有属性clip_upper

序列对象没有属性clip_upper
EN

Stack Overflow用户
提问于 2020-08-14 13:20:06
回答 1查看 1.3K关注 0票数 2

虽然我已经更新了我的pandas包,但仍然得到了相同的错误。有谁能帮我吗?

代码语言:javascript
复制
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'
EN

回答 1

Stack Overflow用户

发布于 2020-10-10 16:24:23

使用clip(upper=limit)签出此link

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63406987

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档