我正在尝试合并2个带有图像数据的DataFrame。df1看起来像这样,其中一列包含图像名称,另一列包含nd.array像素数据:
"Get_jobs": {
"inputs": {
"body": {
"from": "@{convertFromUtc( variables('SelectTime'), variables('timeZone'), 'yyyy-MM-dd HH:mm:ss')}"
},
"host": {
"connection": {
"name": "@parameters('$connections')['sql_2']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/procedures/@{encodeURIComponent(encodeURIComponent('[dbo].[GetJobs]'))}"
},
"runAfter": {
"Refresh_data_for_BI": [
"Succeeded"
]
},
"type": "ApiConnection"
},
df2包含相同的image_name标签,但缺少img的数据。
image_name img
0 Horned_Lark_0133_73882.jpg [[[146, 162, 178], [145, 161, 177], [143, 159,...
1 Horned_Lark_0048_73894.jpg [[[198, 196, 201], [199, 197, 202], [198, 197,...
2 Horned_Lark_0028_74408.jpg [[[112, 138, 67], [102, 130, 56], [95, 125, 51...
3 Horned_Lark_0095_74640.jpg [[[94, 94, 94], [97, 97, 97], [100, 98, 99], [...
4 Pigeon_0037_74696.jpg [[[185, 187, 186], [185, 187, 186], [185, 187,...
我正在尝试合并dfs,以便df2中的nan值将基于 image_name img bird_type
0 Horned_Lark_0133_73882.jpg nan Horned_Lark
1 Horned_Lark_0048_73894.jpg nan Horned_Lark
2 Horned_Lark_0028_74408.jpg nan Horned_Lark
3 Horned_Lark_0095_74640.jpg nan Horned_Lark
4 Pigeon_0037_74696.jpg nan Pigeon
我尝试过:
image_name
但是我收到以下错误:
df3 = df2.merge(df1, how='left', on=['image_name', 'img'])
这个答案TypeError: unhashable type: 'numpy.ndarray'内容不是很多。
有人能在这里解释为什么发生这种情况吗?
谢谢