use-mongodb-database-and-juypter-notebook-to-answer-questions-1
Please submit the Jupyter Notebook and a pdf of the notebook. Use mongoDB queries for the following tasks:
- Import the compustat csv file into a collection. (the same file we used in MySQL homework).
- Use mongoimport with specified field types
- Define a new collection called compustatWithSchema with schema validation.
- Insert data from the compustat collection to the compustatWithSchema collection.
- Get the total number of documents inside the collection.
- Get the total number of distinct value in field “fqtr”. Please note that the distinct() function returns an array instead of documents.
- Return fields (datadate, tic, atq, ltq) from documents which have atq larger than 10,000. Please limit the output records to 5.
- Calculate the average atq for each ticker when the fyearq is larger than 2015. Please limit the output records to 10.
- Save all output records from question 7 into a new collection.
- Export the collection from question 6 to a csv file.
- Use mongoexport with specified field types
- Use mongoexport with specified field types and query for tickers AAPL and ZNGA