成功解决raise KeyError(f“None of [{key}] are in the [{axis_name}]“)KeyError: “None of [Index([‘age.in.y

简介: 成功解决raise KeyError(f“None of [{key}] are in the [{axis_name}]“)KeyError: “None of [Index([‘age.in.y


目录

解决问题

解决思路

解决方法


解决问题

raise KeyError(f"None of [{key}] are in the [{axis_name}]")

KeyError: "None of [Index(['age.in.years'], dtype='object')] are in the [columns]"

解决思路

引发KeyError (f"没有[{key}]]在[{axis_name}]")

关键字错误:"None of [Index(['age.in.]]Years '], dtype='object')]在[列]"

解决方法

train_score = sc.scorecard_ply(train2woe, card_dict, print_step=0)

train2woe

     age.in.years_woe  ...  status.of.existing.checking.account_woe

0           -0.194156  ...                                 0.614204

1            0.528844  ...                                 0.614204

2           -0.194156  ...                                -1.176263

6           -0.194156  ...                                -1.176263

7           -0.563689  ...                                 0.614204

card_dict

35  age.in.years  [-inf,26.0)   -20.0

36  age.in.years  [26.0,35.0)    -2.0

37  age.in.years  [35.0,40.0)    21.0

38  age.in.years   [40.0,inf)     7.0,

输出数据可知,两个dataframe的列名不一致导致的问题!将两个dataframe格式的数据的列名一致化即可!


相关文章
|
4月前
|
数据处理 开发者 Python
【Python】已解决:ValueError: Length mismatch: Expected axis has 5 elements, new values have 4 elements
【Python】已解决:ValueError: Length mismatch: Expected axis has 5 elements, new values have 4 elements
273 9
|
4月前
|
Python
【Python】已解决:(pandas读取DataFrame列报错)raise KeyError(key) from err KeyError: (‘name‘, ‘age‘)
【Python】已解决:(pandas读取DataFrame列报错)raise KeyError(key) from err KeyError: (‘name‘, ‘age‘)
267 0
成功解决AttributeError: ‘Series‘ object has no attribute ‘columns‘
成功解决AttributeError: ‘Series‘ object has no attribute ‘columns‘
|
Python
AttributeError: 'dict' object has no attribute 'has_key'
AttributeError: 'dict' object has no attribute 'has_key'
150 0
AttributeError: ‘list‘ object has no attribute ‘ndim‘
AttributeError: ‘list‘ object has no attribute ‘ndim‘
191 0
|
Python
AttributeError: 'list' object has no attribute 'ndim'
AttributeError: 'list' object has no attribute 'ndim'
539 0
Pandas报错AttributeError: Cannot access callable attribute 'sort_values' of 'DataFrameGroupBy' objects
Pandas报错AttributeError: Cannot access callable attribute 'sort_values' of 'DataFrameGroupBy' objects
TypeError: cannot concatenate ‘str‘ and ‘list‘ objects
TypeError: cannot concatenate ‘str‘ and ‘list‘ objects
|
索引 Python
成功解决ValueError: column index (256) not an int in range(256)
成功解决ValueError: column index (256) not an int in range(256)
成功解决ValueError: column index (256) not an int in range(256)
|
Linux Python
ValueError: empty range for randrange() (0, 0, 0)
ValueError: empty range for randrange() (0, 0, 0)