python 'ReadOnlyWorksheet' object has no attribute 'defined_names'
时间: 2023-08-04 22:03:47 浏览: 332
mdk_armcc_user_guide.pdf
这个错误是因为在使用pandas的read_excel函数读取Excel文件时,出现了"'ReadOnlyWorksheet' object has no attribute 'defined_names'"的错误信息。这个错误通常是由于openpyxl的最新版本引起的。解决这个问题的方法是将openpyxl降级到较低的版本,比如3.1.0。你可以使用pip3 install openpyxl==3.1.0命令来安装指定版本的openpyxl。另外,还有一个关于sheet对象的方法也发生了变化,get_highest_row()和get_highest_column()方法已经被弃用,现在应该使用max_row和column属性来获取行数和列数。你可以尝试使用这些解决方案来解决这个问题。\[1\]\[2\]
#### 引用[.reference_title]
- *1* [python pandas read_excel ‘ReadOnlyWorksheet‘ object has no attribute ‘defined_names](https://blog.csdn.net/weixin_41313523/article/details/129443907)[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~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Python Error解决方案AttributeError: ‘ReadOnlyWorksheet‘ object has no attribute ‘get_highest_row...](https://blog.csdn.net/XRTONY/article/details/113818112)[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~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文