Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

description in attached files. this project had 2 parts before that are attached, part of the work is already done, found in the assignment word doc. probably need the panda database done as well...

1 answer below »
description in attached files. this project had 2 parts before that are attached, part of the work is already done, found in the assignment word doc. probably need the panda database done as well (although not sure) or at least screenshots. message me if any confusions or questions.ps i had a quote for an older assignment but ended up not using your services, it says project is pending so idk if it charged me for it or not, if so please just cancel the last project and only look at this one
Answered Same Day Nov 13, 2021

Solution

Ximi answered on Nov 18 2021
152 Votes
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import sqlite3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"connection = sqlite3.connect('Proj2earfquak/index.sqlite')\n",
"cursor = connection.cursor()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
""
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"cursor.execute(\"SELECT * FROM Earthquakes;\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"table = pd.read_sql_query(\"SELECT * from Earthquakes\", connection)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Part 1 and Part 2"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"placecounts = dict(table.place.value_counts(normalize=False))"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"regioncounts = dict(table.region.value_counts(normalize=False))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"How many earthquake locations to show?20\n",
"\n",
"Top 20 earthquake places\n",
"Central California 417\n",
"Bonin Islands, Japan region 404\n",
"Albania 382\n",
"Northern California 375\n",
"Andreanof Islands, Aleutian Islands, Alaska 319\n",
"New Britain region, Papua New Guinea 277\n",
"Mount St. Helens area, Washington 259\n",
"Vanuatu 235\n",
"Fiji region 213\n",
"Hindu Kush region, Afghanistan 197\n",
"Taiwan region 149\n",
"Aegean Sea 141\n",
"Tonga 133\n",
"Czech Republic 128\n",
"France 123\n",
"northern Italy 115\n",
"offshore Northern California 99\n",
"Greece 96\n",
"southwestern Ryukyu Islands, Japan 95\n",
"south of the Fiji Islands 90\n",
"\n",
"Top 20 earthquake regions\n",
"California 1488\n",
"Japan 891\n",
"Alaska 666\n",
"Indonesia 604\n",
"Mexico 570\n",
"Papua New Guinea 477\n",
"Albania 382\n",
"Washington 340\n",
"Figi 311\n",
"Chile 249\n",
"Vanuatu 245\n",
"Greece 220\n",
"Afghanistan 202\n",
"Taiwan 198\n",
"Tonga 156\n",
"Italy 155\n",
"Philippines 154\n",
"Aegean Sea 141\n",
"France 139\n",
"Czech Republic 132\n"
]
}
],
"source": [
"howmany = int(input(\"How many earthquake locations to show?\"))\n",
"print ('\\nTop', howmany, 'earthquake places')\n",
"\n",
"x = sorted(placecounts, key=placecounts.get, reverse=True)\n",
"for k in x[:howmany]:\n",
" print(k, placecounts[k])\n",
" if placecounts[k] < 10 :
eak\n",
"\n",
"print('\\nTop',howmany,'earthquake regions')\n",
"x = sorted(regioncounts, key=regioncounts.get, reverse=True)\n",
"for k in x[:howmany]:\n",
" print(k, regioncounts[k])\n",
" if regioncounts[k] < 10 :
eak\n"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Basic Statistics\n"
]
}
],
"source": [
"print(\"\\nBasic Statistics\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Place that has the most earthquakes: Central California\n",
"Region that has the most earthquakes: California\n"
]
}
],
"source": [
"print (\"Place that has the most earthquakes: \", sorted(placecounts, key=placecounts.get, reverse=True)[0])\n",
"print (\"Region that has the most earthquakes: \", sorted(regioncounts, key=regioncounts.get, reverse=True)[0])"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"