【问题标题】:what is wrong with my code ? i wanted to see the transformations i did instead getting the error meassage我的代码有什么问题?我想看看我所做的转换而不是得到错误信息
【发布时间】:2019-06-24 13:33:17
【问题描述】:

我收到属性错误:

AttributeError: 'function' 对象没有属性 'suffix'

credit_risk_transform=credit_risk[num_list].copy()

squared=(credit_risk_transform**2).add.suffix("squared")

square_root=(credit_risk_transform**0.5).add.suffix("_sqrt")

natural_log=np.log(credit_risk_transform+1).add,suffix("_ln")

credit_risk_transform=pd.concat([credit_risk_transform,squared,square_root,natural_log],axis=1)

credit_risk_transform.drop(['default_squared','default__sqrt','default_ln'],axis=1,inplace=True)

credit_risk_transform.head()

我想查看我所做的转换而不是收到错误消息

【问题讨论】:

    标签: python pandas


    【解决方案1】:

    这是你用错了函数

    add_suffix("squared")
    

    【讨论】:

      【解决方案2】:

      add.suffix() 表示你正在调用add属性的后缀函数。请改用add_suffix("squared")

      【讨论】:

        猜你喜欢
        • 2016-04-18
        • 1970-01-01
        • 2021-08-04
        • 2016-06-14
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多