1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PythonでMongoDBに接続して、条件を指定して、DataFrameに格納

Last updated at Posted at 2020-04-11

##PythonでMongoDBに接続して、条件を指定して、DataFrameに格納します。

connect.py
import pymongo
import pandas as pd

client = pymongo.MongoClient('localhost', 27017)#localを想定
db = client['#db名']
co = db['#コレクション名']

query  = { "orderDatetime" : { "$gte" : "2019-11-01T00:00:00+09:00" } }
#検索条件
#keyはorderDatetime
#valueは "2019-11-01T00:00:00+09:00" 以上("$gte")

df = pd.DataFrame(co.find(query))
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?