New folder/a21.JPG New folder/a22.JPG New folder/a23.JPG New folder/a24.JPG New folder/a25.JPG New folder/connecting-to-atlas (1).ipynb { "cells": [ { "cell_type": "code", "execution_count": null,...

assignment description in attached pictures. I already have part of the assignment done so it would make it easier for you


New folder/a21.JPG New folder/a22.JPG New folder/a23.JPG New folder/a24.JPG New folder/a25.JPG New folder/connecting-to-atlas (1).ipynb { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from pymongo import MongoClient # this lets us connect to MongoDB\n", "import pprint # this lets us print our MongoDB documents nicely" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# the connection uri to our course cluster\n", "client = MongoClient('mongodb://analytics-student:[email protected]:27017,cluster0-shard-00-01-jxeqq.mongodb.net:27017,cluster0-shard-00-02-jxeqq.mongodb.net:27017/?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# the trips collection on the citibike database\n", "trips = client.citibike.trips" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# find all trips between 5 and 10 minutes in duration that start at station 216\n", "query = {\"tripduration\":{\"$gte\":5000,\"$lt\":10000},\"start station id\":216}\n", "\n", "# only return the bikeid, tripduration, and _id (displayed by default)\n", "projection = {\"bikeid\": 1, \"tripduration\": 1}" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [ "# print all of the trips\n", "for doc in trips.find(query, projection):\n", " pprint.pprint(doc)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.1" } }, "nbformat": 4, "nbformat_minor": 2 } New folder/downloader.ipynb { "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-06-01T23%3A59%3A59&minmag=2.5&limit=500\n", "Retrieved 368596 characters\n", "count = 500\n", "endtime = 1986-05-16T12:48:59.060000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-05-16T12%3A48%3A59.060000&minmag=2.5&limit=500\n", "Retrieved 376166 characters\n", "count = 500\n", "endtime = 1986-05-07T00:59:46.720000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-05-07T00%3A59%3A46.720000&minmag=2.5&limit=500\n", "Retrieved 367098 characters\n", "count = 500\n", "endtime = 1986-04-19T06:45:45.060000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-04-19T06%3A45%3A45.060000&minmag=2.5&limit=500\n", "Retrieved 367028 characters\n", "count = 500\n", "endtime = 1986-03-31T17:20:14.330000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-03-31T17%3A20%3A14.330000&minmag=2.5&limit=500\n", "Retrieved 363841 characters\n", "count = 500\n", "endtime = 1986-03-18T19:12:30.240000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-03-18T19%3A12%3A30.240000&minmag=2.5&limit=500\n", "Retrieved 367386 characters\n", "count = 500\n", "endtime = 1986-02-28T07:05:54.230000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-02-28T07%3A05%3A54.230000&minmag=2.5&limit=500\n", "Retrieved 368102 characters\n", "count = 500\n", "endtime = 1986-02-07T11:19:04.610000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-02-07T11%3A19%3A04.610000&minmag=2.5&limit=500\n", "Retrieved 366283 characters\n", "count = 500\n", "endtime = 1986-01-20T03:44:07.350000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-01-20T03%3A44%3A07.350000&minmag=2.5&limit=500\n", "Retrieved 363409 characters\n", "count = 500\n", "endtime = 1986-01-03T19:26:35.610000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1986-01-03T19%3A26%3A35.610000&minmag=2.5&limit=500\n", "Retrieved 363950 characters\n", "count = 500\n", "endtime = 1985-12-20T06:49:09.230000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-12-20T06%3A49%3A09.230000&minmag=2.5&limit=500\n", "Retrieved 364041 characters\n", "count = 500\n", "endtime = 1985-12-01T12:45:09.220000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-12-01T12%3A45%3A09.220000&minmag=2.5&limit=500\n", "Retrieved 363779 characters\n", "count = 500\n", "endtime = 1985-11-17T20:38:46.950000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-11-17T20%3A38%3A46.950000&minmag=2.5&limit=500\n", "Retrieved 368406 characters\n", "count = 500\n", "endtime = 1985-10-28T20:32:25.290000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-10-28T20%3A32%3A25.290000&minmag=2.5&limit=500\n", "Retrieved 367277 characters\n", "count = 500\n", "endtime = 1985-10-08T22:07:14.910000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-10-08T22%3A07%3A14.910000&minmag=2.5&limit=500\n", "Retrieved 367526 characters\n", "count = 500\n", "endtime = 1985-09-22T23:49:27.470000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-09-22T23%3A49%3A27.470000&minmag=2.5&limit=500\n", "Retrieved 367962 characters\n", "count = 500\n", "endtime = 1985-09-04T09:42:22.240000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-09-04T09%3A42%3A22.240000&minmag=2.5&limit=500\n", "Retrieved 368248 characters\n", "count = 500\n", "endtime = 1985-08-17T10:55:23.680000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-08-17T10%3A55%3A23.680000&minmag=2.5&limit=500\n", "Retrieved 371151 characters\n", "count = 500\n", "endtime = 1985-07-31T09:28:37.960000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-07-31T09%3A28%3A37.960000&minmag=2.5&limit=500\n", "Retrieved 368201 characters\n", "count = 500\n", "endtime = 1985-07-10T20:06:20.020000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-07-10T20%3A06%3A20.020000&minmag=2.5&limit=500\n", "Retrieved 367176 characters\n", "count = 500\n", "endtime = 1985-06-21T22:34:28.320000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-06-21T22%3A34%3A28.320000&minmag=2.5&limit=500\n", "Retrieved 368092 characters\n", "count = 500\n", "endtime = 1985-06-02T21:12:07.990000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-06-02T21%3A12%3A07.990000&minmag=2.5&limit=500\n", "Retrieved 374048 characters\n", "count = 500\n", "endtime = 1985-05-24T03:13:05.320000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-05-24T03%3A13%3A05.320000&minmag=2.5&limit=500\n", "Retrieved 369833 characters\n", "count = 500\n", "endtime = 1985-05-09T03:25:38.380000 \n", "\n", "Retrieving http://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=1985-05-02T00%3A00%3A00&endtime=1985-05-09T03%3A25%3A38.380000&minmag=2.5&limit=500\n", "Retrieved 150124 characters\n", "count = 203\n", "endtime = 1985-05-02T03:16:07.310000 \n", "\n" ] } ], "source": [ "import urllib.request, urllib.parse, urllib.error\n", "import json\n", "\n", "earthquakeURL = \"http://earthquake.usgs.gov/fdsnws/event/1/query?\"\n", "paramD = dict()\n", "paramD[\"format\"] = \"geojson\" # the format the data
Oct 28, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here