one_hot_columns_list = ["申请类型",'标记已注销的借款人是否与债务清偿公司合作' ,'贷款初始状态',"房产权","收入来源是否已核实","借款人在贷款申请中提供的状态"]
时间: 2023-11-03 11:53:25 浏览: 32
这是一个包含多个字符串元素的列表,每个元素代表一个特征列的名称。这些特征列可能被用来训练一个机器学习模型,其中每个特征被转换为一个二进制的 0/1 值(也叫做 one-hot 编码)。在这个列表中,特征列的名称包括申请类型、标记已注销的借款人是否与债务清偿公司合作、贷款初始状态、房产权、收入来源是否已核实以及借款人在贷款申请中提供的状态。
相关问题
bin_data.rename(columns = {ind:'Fail_Rate%'},inplace=True)
在给定的代码中,`bin_data.rename(columns={ind: 'Fail_Rate%'}, inplace=True)` 用于重命名 DataFrame 中的列。
`bin_data` 是你的 DataFrame 对象,`ind` 是你想要重命名的列名。通过使用 `rename()` 方法和 `columns` 参数,你可以将指定的列名 `ind` 更改为 `'Failate%'`。`inplace=True` 的作用是在原地修改 DataFrame,而不是创建一个副本。
完整的代码如下:
```python
bin_data.rename(columns={ind: 'Fail_Rate%'}, inplace=True)
```
这将把 `bin_data` DataFrame 中的列名 `ind` 更改为 `'Fail_Rate%'`。
adf = func_corr_adf() drop_columns_list = adf[adf["缺失值占比"]>=0.80].index
这段代码似乎有点问题,可能是因为出现了语法错误。根据代码中的函数名和变量名,我猜测你想要做的是删除一个 DataFrame 中缺失值占比超过 80% 的列。如果是这样,可以尝试修改代码如下:
```
adf = func_corr_adf()
drop_columns_list = adf.columns[adf.isnull().mean() >= 0.8]
adf.drop(drop_columns_list, axis=1, inplace=True)
```
这里使用 `isnull()` 函数来检查 DataFrame 中每个元素是否为缺失值,并通过 `mean()` 函数计算每列缺失值占比。然后,使用布尔索引来选出缺失值占比超过 80% 的列,并将它们的列名保存到 `drop_columns_list` 变量中。最后,使用 `drop()` 方法来删除这些列。需要注意的是,`drop()` 方法会返回一个新的 DataFrame,因此需要将 `inplace` 参数设置为 `True`,才能在原地修改 DataFrame。
相关推荐
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)