def getuser():
users = user.find({
'totalRecharge': {'$gt': 0},
'$or': [
{'recharge.from': 'weixin'},
{'recharge.from': 'alipay'},
{'recharge.from': {'$ne': 'jCode'}},
{'recharge.from': {'$ne': 'regCoupon'}}
]
})
data = [u for u in users]
frame = pd.DataFrame(data, columns=['phone', 'balance', 'totalRecharge'])
print(frame[(frame['balance']/100 > 100) & (frame['totalRecharge']/100 > 1000)].count())
return
最近重新研究Python用于数据统计,数据库是MongoDB,最近发现Pandas有的会与Pymongo的聚合管道功能相近,pandas目前还不熟练 基本上都是边写边去网上找一些方法。
- 问题数据库的里int字段比例都是1:100 比如balance字段 1元=100.如何在构建dataframe时除以100?
- 而且groupbycut这些方法为什么国内很少有文章?
- 一堆各种入门、必看、XX个牛逼方法 尼玛全都是来回复制的文档的,真正自己使用总结或使用的干货却很少?
从代码量看我还是比较倾向Pandas! 请老手们给条明路。