从pymongo 提取最近100条数据
import pymongo
from pymongo import MongoClient
import numpy as np
import pandas as pd
from pandas import DataFrame,Series
from numpy import row_stack,column_stack
from dateutil.parser import parse
ct = "上海"
rl = "长宁"
lk = "新泾三村"
client = MongoClient('192.168.10.88',27777)
db = client.fangjia
seawater = db.seawater
query = {"city":ct,"cat":"sell","region":rl,"district_name":lk}
pos = list()
cursor = seawater.find(query,{"p_date":-1}).sort([("p_date",-1)])
for s in cursor:
print(s)
pos.append(s)
感谢小伙伴王文艳