Using numpy to build an array of all combinations of two arrays
Cartesian product function by Stackoverflow user, pv
.
See Answer here.
option = { | |
title: { | |
text: '受访者省份分布', | |
left: 'left', | |
top: 'bottom' | |
}, | |
tooltip: { | |
trigger: 'item', | |
formatter: '{a} <br/>{b} : {c}%' | |
}, |
Using numpy to build an array of all combinations of two arrays
Cartesian product function by Stackoverflow user, pv
.
See Answer here.
//equivalent of MySQL SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName; | |
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}]); | |
//as above but ordered by the count descending | |
//eg: SELECT COUNT(*) AS cnt, fieldName FROM someTable GROUP BY fieldName ORDER BY cnt DESC; | |
db.someCollection.aggregate([{"$group" : {_id:"$fieldName", cnt:{$sum:1}}}, {$sort:{'cnt':-1}}]); | |
db.order.aggregate([{ $group: { _id: "$seller_email", total_order: { "$sum": 1 }, | |
seller_address_1 : { $first: '$seller_address_1' }, | |
seller_country : { $first: '$seller_country' }, |