Hi, I need to develop a query and plot a graph for two questions based on a database. I have attached files for questions, a reference sheet for tables and graphs, and the CSV file.

1 answer below ยป
Hi, I need to develop a query and plot a graph for two questions based on a database. I have attached files for questions, a reference sheet for tables and graphs, and the CSV file.
Answered 2 days AfterApr 10, 2021

Answer To: Hi, I need to develop a query and plot a graph for two questions based on a database. I have...

Sandeep Kumar answered on Apr 11 2021
142 Votes
{
"metadata": {
"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.9.4-final"
},
"orig_nbformat": 2,
"kernelspec": {
"name": "python394jvsc74a57bd081118431cc388d258ed977b65143603a98f8ad6ed776c173758a3af876bc6de9",
"display_name": "Python 3.9.4 64-bit"
}
},
"nbformat": 4,
"nbformat_minor": 2,
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd \n",
"import numpy as np\n",
"import matplotlib.pyplot as plt"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"shark = pd.read_csv('SharkData.csv')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
" SharkSpeciesName NumberSpecimens Specimenid SharkLength \\\n",
"0 Smoothhound 3 1 104.81 \n",
"1 Smoothhound 3 1 104.81 \n",
"2 Smoothhound 3 2 100.00 \n",
"3 Smoothhound 3 2 100.00 \n",
"4 Smoothhound 3 3 62.00 \n",
"5 Smoothhound 3 3 62.00 \n",
"6 Spiny 3 1 92.00 \n",
"7 Spiny 3 1 92.00 \n",
"8 Spiny 3 2 85.00 \n",
"9 Spiny 3 2 85.00 \n",
"10 Spiny 3 4 97.00 \n",
"11 Spiny 3 4 97.00 \n",
"12 Bamboo 3 1 88.40 \n",
"13 Bamboo 3 1 88.40 \n",
"14 Bamboo 3 2 77.80 \n",
"15 Bamboo 3 2 77.80 \n",
"16 Bamboo 3 3 84.50 \n",
"17 Bamboo 3 3 84.50 \n",
"18 Sandbar 3 1 68.40 \n",
"19 Sandbar 3 1 68.40 \n",
"20 Sandbar 3 2 54.10 \n",
"21 Sandbar 3 2 54.10 \n",
"22 Sandbar
3 3 56.00 \n",
"23 Sandbar 3 3 56.00 \n",
"24 Mako 3 1 175.00 \n",
"25 Mako 3 1 175.00 \n",
"26 Mako 3 2 194.00 \n",
"27 Mako 3 2 194.00 \n",
"28 Mako 3 3 185.00 \n",
"29 Mako 3 3 185.00 \n",
"30 Skate 3 1 46.90 \n",
"31 Skate 3 1 46.90 \n",
"32 Skate 3 2 44.37 \n",
"33 Skate 3 2 44.37 \n",
"34 Skate 3 3 45.33 \n",
"35 Skate 3 3 45.33 \n",
"36 Thresher 1 2 225.00 \n",
"37 Thresher 1 2 225.00 \n",
"\n",
" MuscleName MuscleMass MuscleForce MuscleCrossSectionalArea \\\n",
"0 Smoothhound 1 PO 1.286 1.925 0.325 \n",
"1 Smoothhound 1 QM 4.753 36.127 2.199 \n",
"2 Smoothhound 2 PO 1.469 2.685 0.444 \n",
"3 Smoothhound 2 QM 5.978 34.755 2.682 \n",
"4 Smoothhound 3 PO 0.460 1.348 0.241 \n",
"5 Smoothhound 3 QM 1.706 17.295 1.345 \n",
"6 Spiny 1 PO 1.150 5.520 0.984 \n",
"7 Spiny 1 QM 6.681 31.670 3.891 \n",
"8 Spiny 2 PO 0.867 4.108 0.493 \n",
"9 Spiny 2 QM 5.001 23.188 2.587 \n",
"10 Spiny 4 PO 1.119 2.022 0.302 \n",
"11 Spiny 4 QM 7.788 38.920 3.746 \n",
"12 Bamboo 1 PO 3.576 29.477 1.223 \n",
"13 Bamboo 1 QM 6.513 34.499 2.844 \n",
"14 Bamboo 2 PO 3.551 45.326 1.878 \n",
"15 Bamboo 2 QM 7.022 36.430 2.938 \n",
"16 Bamboo 3 PO 0.460 NaN 1.693 \n",
"17 Bamboo 3 QM 7.128 NaN 3.945 \n",
"18 Sandbar 1 PO 1.886 4.232 0.438 \n",
"19 Sandbar 1 QM 3.986 17.845 1.988 \n",
"20 Sandbar 2 PO 0.859 4.270 0.328 \n",
"21 Sandbar 2 QM 1.567 9.029 0.968 \n",
"22 Sandbar 3 PO 0.640 2.618 0.213 \n",
"23 Sandbar 3 QM 1.232 6.197 0.756 \n",
"24 Mako 1 PO 0.710 6.659 0.683 \n",
"25 Mako 1 QM 108.750 165.931 13.450 \n",
"26 Mako 2 PO 5.201 5.385 0.543 \n",
"27 Mako 2 QM 86.197 148.462 14.242 \n",
"28 Mako 3 PO 13.772 12.956 1.468 \n",
"29 Mako 3 QM 188.000 216.035 23.442 \n",
"30 Skate 1 PO 0.346 3.062 0.260 \n",
"31 Skate 1 QM 5.753 57.628 5.420 \n",
"32 Skate 2 PO 0.085 0.978 0.083 \n",
"33 Skate 2 QM 1.660 14.173 1.555 \n",
"34 Skate 3 PO 0.137 1.740 0.153 \n",
"35 Skate 3 QM 3.768 26.207 27.540 \n",
"36 Thresher 2 PO 6.006 18.475 1.500 \n",
"37 Thresher 2 QM 43.494 144.641 10.753 \n",
"\n",
" SharkBiteForce \n",
"0 38.052 \n",
"1 38.052 \n",
"2 37.440 \n",
"3 37.440 \n",
"4 18.643 \n",
"5 18.643 \n",
"6 37.222 \n",
"7 37.222 \n",
"8 27.296 \n",
"9 27.296 \n",
"10 40.942 \n",
"11 40.942 \n",
"12 39.236 \n",
"13 39.236 \n",
"14 39.368 \n",
"15 39.368 \n",
"16 NaN \n",
"17 NaN \n",
"18 22.077 \n",
"19 22.077 \n",
"20 13.300 \n",
"21 13.300 \n",
"22 8.814 \n",
"23 8.814 \n",
"24 172.590 \n",
"25 172.590 \n",
"26 153.847 \n",
"27 153.847 \n",
"28 228.991 \n",
"29 228.991 \n",
"30 60.690 \n",
"31 60.690 \n",
"32 15.151 \n",
"33 15.151 \n",
"34 27.947 \n",
"35 27.947 \n",
"36 163.116 \n",
"37 163.116 "
],
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iteForce
0Smoothhound31104.81Smoothhound 1 PO1.2861.9250.32538.052
1Smoothhound31104.81Smoothhound 1 QM4.75336.1272.19938.052
2Smoothhound32100.00Smoothhound 2 PO1.4692.6850.44437.440
3Smoothhound32100.00Smoothhound 2 QM5.97834.7552.68237.440
4Smoothhound3362.00Smoothhound 3 PO0.4601.3480.24118.643
5Smoothhound3362.00Smoothhound 3 QM1.70617.2951.34518.643
6Spiny3192.00Spiny 1 PO1.1505.5200.98437.222
7Spiny3192.00Spiny 1 QM6.68131.6703.89137.222
8Spiny3285.00Spiny 2 PO0.8674.1080.49327.296
9Spiny3285.00Spiny 2 QM5.00123.1882.58727.296
10Spiny3497.00Spiny 4 PO1.1192.0220.30240.942
11Spiny3497.00Spiny 4 QM7.78838.9203.74640.942
12Bamboo3188.40Bamboo 1 PO3.57629.4771.22339.236
13Bamboo3188.40Bamboo 1 QM6.51334.4992.84439.236
14Bamboo3277.80Bamboo 2 PO3.55145.3261.87839.368
15Bamboo3277.80Bamboo 2 QM7.02236.4302.93839.368
16Bamboo3384.50Bamboo 3 PO0.460NaN1.693NaN
17Bamboo3384.50Bamboo 3 QM7.128NaN3.945NaN
18Sandbar3168.40Sandbar 1 PO1.8864.2320.43822.077
19Sandbar3168.40Sandbar 1 QM3.98617.8451.98822.077
20Sandbar3254.10Sandbar 2 PO0.8594.2700.32813.300
21Sandbar3254.10Sandbar 2 QM1.5679.0290.96813.300
22Sandbar3356.00Sandbar 3 PO0.6402.6180.2138.814
23Sandbar3356.00Sandbar 3 QM1.2326.1970.7568.814
24Mako31175.00Mako 1 PO0.7106.6590.683172.590
25Mako31175.00Mako 1 QM108.750165.93113.450172.590
26Mako32194.00Mako 2 PO5.2015.3850.543153.847
27Mako32194.00Mako 2 QM86.197148.46214.242153.847
28Mako33185.00Mako 3 PO13.77212.9561.468228.991
29Mako33185.00Mako 3 QM188.000216.03523.442228.991
30Skate3146.90Skate 1 PO0.3463.0620.26060.690
31Skate3146.90Skate 1 QM5.75357.6285.42060.690
32Skate3244.37Skate 2 PO0.0850.9780.08315.151
33Skate3244.37Skate 2 QM1.66014.1731.55515.151
34Skate3345.33Skate 3 PO0.1371.7400.15327.947
35Skate3345.33Skate 3 QM3.76826.20727.54027.947
36Thresher12225.00Thresher 2 PO6.00618.4751.500163.116
37Thresher12225.00Thresher 2 QM43.494144.64110.753163.116
\n
"
},
"metadata": {},
"execution_count": 4
}
],
"source": [
"shark"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"i = shark[\"SharkBiteForce\"].value_counts()\n",
"count = 0"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"subset_df = shark[shark[\"SharkBiteForce\"] > 100]\n",
"column_count = subset_df.count()"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"8"
]
},
"metadata": {},
"execution_count": 7
}
],
"source": [
"column_count[\"SharkBiteForce\"]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"[]"
]
},
"metadata": {},
"execution_count": 8
},
{
"output_type": "display_data",
"data": {
"text/plain": "
",
"image/svg+xml": "\r\n\r\n\r\n \r\n\r\n\r\n\r\n2021-04-12T17:42:04.875111\r\nimage/svg+xml\r\n\r\n\r\nMatplotlib v3.4.1, https://matplotlib.org/\r\n\r\n\r\n\r\n\r\n \r\n \r\n\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here