假设我有一个文档:
{
"_id": {
"$oid": "5cb3f4a098c73d1625970740"
},
"Dimensions": {
"Dimension_1": "NaN",
"Dimension_2": 1.5
},
"Other Dimensions": {
"Dimension_1": "NaN",
"Dimension_2": 1.5,
}
}
预期输出:
{
"_id": {
"$oid": "5cb3f4a098c73d1625970740"
},
"Dimensions": {
"Dimension_1": null,
"Dimension_2": 1.5
},
"Other Dimensions": {
"Dimension_1": null,
"Dimension_2": 1.5,
}
}
如何使用PyMongo将文档中的每个字符串"NaN"
切换到null
?