Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 3: Line graph to display trend The block of code below will create a line plot of temperature data. You will use the matplotlib.pyplot

image text in transcribed
Step 3: Line graph to display trend The block of code below will create a line plot of temperature data. You will use the matplotlib.pyplot submodule to create the line chart. Click the code section below and hit the Run button above. NOTE: If the graph is not created, click the code section and hit the Run button again. In [ ]: import matplotlib. pyplot as pit # line chart plt. plot (temperatures_df [ 'temperature' ]) # plot setting a title for the plot, x-axis and y-axis pit. title( 'Line plot of temperature data", fontsize-20) pit. xlabel ( "day" ) pit. ylabel ( " temperature' ) # show the plot pit. show( ) Step 4: Side-by-side boxplots to compare distributions The block of code below will create side-by-side boxplots of your temperature data and the temperature data from another location called "Zion'. Boxplots can be used to visualy compare data distributions, In this code block, you will use the seaborn module in Python to create a side-by-side boxplot. The temperature data for Zion will be generated automatically in the code section below. You are not required to know how this data was generated. Note that the temperature data for Zion will be unique to you. Click the code section below and hit the Run button above. NOTE: If the graph is not created, click the code section and hit the Run button again. In [ ]: import matplotlib. pyplot as pit import seaborn as ans import numpy as ap import random creates temperature data for Tion. You don't need to know how this data is created. The temperature data created for Sion will be unique to you. mean - random, randint (temperatures_di[ ' temperature' ].min( ), temperatures_df[ ' temperature' ].max( ) ) atd_deviation = random. randint ( round (temperatures_df[ ' temperature' ].atd( ), 0) , round(2*temperatures_df [ ' temperature' ].at zion_temperatures = ap. random. normal (mean, atd_deviation, 25) zion_temperatures = pd. DataFrame (zion_temperatures, columns=[' temperature' ]) # side-by-side boxplots require the two dataframes to be concatenated and require a variable identifying the data temperatures_df[ 'id' ] = 'my_data" zion_temperatures [ 'id' ] . 'zion_data" both_temp_df = pd. concat( ( temperatures_df, zion_temperatures) ) # sets a title for the plot, x-axis, and y-axis pit. title( Boxplot for comparison', fontsize-20) # prepares the boxplot ans. boxplot (x="id" ,y="temperature", data-both_temp_df} # shows the plot pit. show ( )

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions