'DataFrame' object has no attribute 'ix'
时间: 2023-09-08 21:08:11 浏览: 206
"'DataFrame' object has no attribute 'ix'" 是因为在最新版本的pandas中,ix属性已被废弃,不再推荐使用。 在使用DataFrame.ix时会出现这个错误。要解决这个问题,可以考虑使用其他代替ix的方法,比如使用iloc或loc来进行数据块选择。 例如,可以将代码中的fdata.ix替换为fdata.loc或fdata.iloc来解决此问题。具体代码如下:
fdata.loc[fdata['time']=='Diner', 'time'] = 'Dinner' fdata.loc[fdata['time']=='Dier', 'time'] = 'Dinner' fdata['time'].unique()
使用loc或iloc方法,可以实现相同的功能,并且不会出现"'DataFrame' object has no attribute 'ix'"错误。123
引用[.reference_title]
- 1 2 已解决:pandas报AttributeError: DataFrame object has no attribute ix错误[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2
allinsert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - 3 编写Python 代码出现 AttributeError: ‘DataFrame‘ object has no attribute ‘ix‘ 报错[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2
allinsert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
相关推荐
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.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://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![c](https://img-home.csdnimg.cn/images/20250102104920.png)