有一个带值的 df
df:
165 156 1 test greater 56gsa
-------------------------------------
spin 201 2 normal lesser 12asgs
pine 202 3 fast greater 5sasgs
Run Code Online (Sandbox Code Playgroud)
所需输出:
0 1 2 3 4 5
-------------------------------------
165 156 1 test greater 56gsa
spin 201 2 normal lesser 12asgs
pine 202 3 fast greater 5sasgs
Run Code Online (Sandbox Code Playgroud) 有一个带有值的集合
_id:ObjectId('......')
ton_id :ObjectId('abcd')
value:587900
date:2019-12-13T07:09:40.075+00:00
_id:ObjectId('......')
ton_id :ObjectId('abcd')
value:50540
date:2018-1-13T07:09:40.075+00:00
_id:ObjectId('......')
ton_id :ObjectId('abcd1')
value:55400
date:2019-5-13T07:09:40.075+00:00
_id:ObjectId('......')
ton_id :ObjectId('abcd1')
value:22500
date:2018-12-13T07:09:40.075+00:00
Run Code Online (Sandbox Code Playgroud)
对于 ton_idsabcd并abcd1删除除最旧记录之外的所有记录。
所需的输出
_id:ObjectId('......')
ton_id :ObjectId('abcd')
value:50540
date:2018-1-13T07:09:40.075+00:00
_id:ObjectId('......')
ton_id :ObjectId('abcd1')
value:22500
date:2018-12-13T07:09:40.075+00:00
Run Code Online (Sandbox Code Playgroud) aggregate-functions mongodb mongodb-query aggregation-framework
有一个带值的 df
df
0 1
sun NaN
moon 123
cat NaN
dog yatch
Run Code Online (Sandbox Code Playgroud)
将已经存在的值转为通过,将 NaN 转为失败
预期输出
0 1
sun fail
moon pass
cat fail
dog pass
Run Code Online (Sandbox Code Playgroud)