Tushare基础调用及处理

创建索引:

db.daily.createIndex({code:1,date:1,'index':1})

mongodb查看表有几列:

map = function() {
for (var key in this) {
emit(key, {count : 1});
}};


reduce = function(key, emits) {
total = 0;
for (var i in emits) {
total += emits[i].count;
}
return {"count" : total};
}


db.runCommand({"mapreduce" : "表名", "map" : map, "reduce" : reduce,"out":"result"})


db.result.find()

 

 

错误:UserWarning: Attempting to set identical left==right results in singular transformations; automatically expanding. left=0.0, right=0.0   'left=%s, right=%s') % (left, right))

是因为参数过大,数据不够

 

posted @ 2019-11-18 19:02  wx_h13813744  阅读(661)  评论(0编辑  收藏  举报