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))

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

原文地址:https://www.cnblogs.com/2186009311CFF/p/11884367.html