logo
Loading...

出現can only convert an array of size 1 to a Python scalar錯誤 - Cupoy

在app_train.loc[0:10000, ['NAME_CONTRACT_TYPE', 'AM...

ml100-2,ml100-2-d08

出現can only convert an array of size 1 to a Python scalar錯誤

2019/04/23 上午 11:39
機器學習共學討論版
鄭博元
觀看數:8
回答數:1
收藏數:0
ml100-2
ml100-2-d08

回答列表

  • 2019/04/23 下午 04:32
    張維元 (WeiYuan)
    贊同數:
    不贊同數:
    留言數:

    這題應該是程式碼有錯誤:


    app_train.loc[0:10000, ['NAME_CONTRACT_TYPE', 'AMT_INCOME_TOTAL', 'AMT_CREDIT', 'AMT_ANNUITY']].groupby(['NAME_CONTRACT_TYPE']).apply(lambda x: x / x.mean() )


    改成這樣試試看:


    app_train.loc[0:10000, ['NAME_CONTRACT_TYPE', 'AMT_INCOME_TOTAL', 'AMT_CREDIT', 'AMT_ANNUITY']].groupby(['NAME_CONTRACT_TYPE'])[['AMT_INCOME_TOTAL', 'AMT_CREDIT', 'AMT_ANNUITY']].apply(lambda x: x / x.mean() )