Fix Python – How to import data from mongodb to pandas?

I have a large amount of data in a collection in mongodb which I need to analyze. How do i import that data to pandas?
I am new to pandas and numpy.
The mongodb collection contains sensor values tagged with date and time. The sensor values are of float datatype.
Sample Data:
“_cls” : “SensorReport”,
“_id” : ObjectId(“515a963b78f6a035d9fa5….

Fix Python – Using .sort with PyMongo

With PyMongo, when I try to retrieve objects sorted by their ‘number’ and ‘date’ fields like this:
db.test.find({“number”: {“$gt”: 1}}).sort({“number”: 1, “date”: -1})

I get this error:
TypeError: if no direction is specified, key_or_list must be an instance of list

What’s wrong with my sort query?

Fix Python – How to sort mongodb with pymongo

I’m trying to use the sort feature when querying my mongoDB, but it is failing. The same query works in the MongoDB console but not here. Code is as follows:
import pymongo

from pymongo import Connection
connection = Connection()
db = connection.myDB
print db.posts.count()
for post in db.posts.find({}, {‘entities.user_mentions.screen_name’:1})….