Does anybody know how to use quandl module/API for Python to store datasets and databases into a single database using postgresql or mongodb. Any help will be much appreciated. Thanks.
Asked
Active
Viewed 725 times
2
-
If my answer helped you solve your problem, you can upvote and accept it. Otherwise, I am happy to continue to help you if you elaborate on your problem. – roob Sep 13 '17 at 17:55
1 Answers
0
The data returned from the quandl API are pandas dataframes.
You can save pandas dataframes to mongodb like this using PyMongo
:
df = quandl.get("FRED/GDP",returns="pandas")
records = json.loads(df.T.to_json()).values()
db.myCollection.insert(records)
See this post for more information
To write to a SQL database, you can use the to_sql
method on the pandas dataframe. See this post for more information

roob
- 2,419
- 3
- 29
- 45