ColumnTransformer object has no attribute set_output
时间: 2023-10-09 13:11:46 浏览: 74
`ColumnTransformer` object does not have an attribute named `set_output`. It could be possible that you are trying to use a method that does not exist in the `ColumnTransformer` class.
You can refer to the documentation of `ColumnTransformer` to see the available methods and attributes. Alternatively, if you can provide more information on what you are trying to achieve, I can assist you further.
相关问题
AttributeError: 'Sheet' object has no attribute 'max_row'
引用\[1\]:Python使用pandas库实现MySQL查询数据库查到的数据导出Excel表,在设定列宽时报错:AttributeError: 'Worksheet' object has no attribute 'set_column' 代码如下 import pandas as pd import pandas.io.formats.excel def downloadExcel(): # 查询数据库的函数实现部分省略 sql = "SELECT * FROM XIAOBAIBAI_LOG WHERE ID='666'" resList = mysqlData.search(sql) # resList为查询到的结果 cols = mysqlData.cur.description col = \[\] for c in cols: col.append(c\[0\]) # 提取数据库的columns作为每列标题 df = pd.DataFrame(list(resList), columes=col) pandas.io.formats.excel.header_style = None writer = pd.ExcelWriter(r"output/XIAOBAIBAI_LOG.xls") df.to_excel(writer, sheet_name='XIAOBAIBAI_LOG') worksheet = writer.sheets\['XIAOBAIBAI_LOG'\] worksheet.set_column("A:A",15) # 设置A列宽度为15 writer.save() writer.close() 解决方案: 。 引用\[2\]:看了很多解决 AttributeError: 'Worksheet' object has no attribute 'set_column' 错误的方案,尝试了都没有解决,结果发现一个小细节,原因竟然是Excel导出后缀的问题,之前对Excel的操作都保存为 .xls 格式,也没有问题,但是使用 set_column 方法出现报错了,把后缀改为.xlsx 报错就没有了。 writer = pd.ExcelWriter(r"output/XIAOBAIBAI_LOG.xlsx") 其他可能原因分析: 。 引用\[3\]:sheet.get_highest_row()和sheet.get_highest_column()在多年前就已经弃用了,现在用的是: sheet.max_row和sheet.column 再次启动:(就不会报错了) 搞定!。 问题:AttributeError: 'Sheet' object has no attribute 'max_row'
回答: 在你的代码中,出现了两个不同的错误。首先,关于'Worksheet' object has no attribute 'set_column'的错误,这是因为你使用了旧版本的Excel文件格式(.xls)。解决方法是将文件后缀改为.xlsx,即writer = pd.ExcelWriter(r"output/XIAOBAIBAI_LOG.xlsx")。\[2\]其次,关于'AttributeError: 'Sheet' object has no attribute 'max_row''的错误,这是因为你使用了过时的方法sheet.get_highest_row()和sheet.get_highest_column()。正确的方法是使用sheet.max_row和sheet.column。\[3\]通过更正这两个错误,你应该能够成功导出Excel文件并设置列宽。
#### 引用[.reference_title]
- *1* *2* [Python错误: AttributeError: ‘Worksheet‘ object has no attribute ‘set_column‘ 解决办法](https://blog.csdn.net/qq_39691492/article/details/119757362)[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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [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^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
'image'object has no attribute'color_track'
很抱歉,在OpenMV上没有`color_track`方法。我给出的代码中的`color_track`方法是一个错误。请使用下面更新后的代码来进行红色和蓝色圆形和矩形的识别:
```python
import sensor
import image
import time
import math
# 初始化摄像头
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
# 设置蓝色和红色的阈值
blue_thresholds = [(0, 100, -128, 127, -128, 127)] # 蓝色阈值,可以根据实际情况调整
red_thresholds = [(0, 100, 0, 127, -128, 127)] # 红色阈值,可以根据实际情况调整
while(True):
# 捕获图像
img = sensor.snapshot()
# 执行颜色追踪(蓝色)
blue_mask = img.binary([blue_thresholds])
# 执行颜色追踪(红色)
red_mask = img.binary([red_thresholds])
# 执行形状检测(蓝色圆形)
blue_circles = img.find_circles(threshold = 2000)
for circle in blue_circles:
img.draw_circle(circle.x(), circle.y(), circle.r(), color=(255, 0, 0))
print("Blue circle detected!")
# 执行形状检测(红色圆形)
red_circles = img.find_circles(threshold = 2000)
for circle in red_circles:
img.draw_circle(circle.x(), circle.y(), circle.r(), color=(0, 0, 255))
print("Red circle detected!")
# 执行形状检测(蓝色矩形)
blue_rects = img.find_rects(threshold = 2000)
for rect in blue_rects:
img.draw_rectangle(rect.rect(), color=(255, 0, 0))
print("Blue rectangle detected!")
# 执行形状检测(红色矩形)
red_rects = img.find_rects(threshold = 2000)
for rect in red_rects:
img.draw_rectangle(rect.rect(), color=(0, 0, 255))
print("Red rectangle detected!")
# 保存图像到文件
img.save("output.jpg")
```
这个代码会捕获图像,执行颜色追踪获得蓝色和红色的二值图像,然后进行形状检测来识别圆形和矩形。请根据需要调整阈值和其他参数以适应你的应用场景。如果还有其他问题,请随时提问。