Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question: Hi I need help on creating a bar graph for the given python script I already did the boxplots but... Hi I need help

Question: Hi I need help on creating a bar graph for the given python script I already did the boxplots but...

Hi I need help on creating a bar graph for the given python script I already did the boxplots but I also want to add a graph in one cell table can someone please help me for the variables of emxt and emxp separate bar graphs for emxt the months of the weather is may through September and for emxp the months is July August and September.For creating Anova bar graph hypothesis testing level of significance is 5% and it should be for the weather of manchester new hampshire the years are 1930-1958. Just give me the steps and the way it should be added in the python script below with the same variables and everything the same and I will put it in the program and see if it will work. Please and the graph should be one cell table from the top to the bottom like buildings bars graph from the middle to the bottom of the graph.

import pandas as pd

import scipy.stats as st

import pandas as pd

import warnings

warnings.filterwarnings("ignore")

##Step 1: Import your data set

##-----------------------------------------------------------------------------

manchesterweather = pd.read_csv('ManchesterWeather.csv')

####### Step 2: Analysis of Variance for five population means

##----------------------------------------------------------------------------------------------------------------

print ('Analysis of Variance for five population means - Step 2')

may_data = manchesterweather.loc[manchesterweather['Month'] == 5]['EMXT']

jun_data = manchesterweather.loc[manchesterweather['Month'] == 6]['EMXT']

jul_data = manchesterweather.loc[manchesterweather['Month'] == 7]['EMXT']

aug_data = manchesterweather.loc[manchesterweather['Month'] == 8]['EMXT']

sep_data = manchesterweather.loc[manchesterweather['Month'] == 9]['EMXT']

print (st.f_oneway(may_data, jun_data, jul_data, aug_data, sep_data))

print ('')

####### Step 3: Analysis of Variance for six population means

##----------------------------------------------------------------------------------------------------------------

print ('Analysis of Variance for three population means - Step 3')

jul_data = manchesterweather.loc[manchesterweather['Month'] == 7]['EMXP']

aug_data = manchesterweather.loc[manchesterweather['Month'] == 8]['EMXP']

sep_data = manchesterweather.loc[manchesterweather['Month'] == 9]['EMXP']

print (st.f_oneway(jul_data, aug_data, sep_data))

print ('')

####### Step 4: Plot boxplots to evaluate any significant differences (5 Means).

##----------------------------------------------------------------------------------------------------------------

print ('Boxplots for five population means - Step 4 (NOTE: Boxplots will be saved in a file called step4_5_means.png)')

import pandas as pd

import matplotlib

matplotlib.use('agg')

import matplotlib as mpl

import matplotlib.pyplot as plt

may_data = manchesterweather.loc[manchesterweather['Month'] == 5]['EMXT']

jun_data = manchesterweather.loc[manchesterweather['Month'] == 6]['EMXT']

jul_data = manchesterweather.loc[manchesterweather['Month'] == 7]['EMXT']

aug_data = manchesterweather.loc[manchesterweather['Month'] == 8]['EMXT']

sep_data = manchesterweather.loc[manchesterweather['Month'] == 9]['EMXT']

data = [may_data, jun_data, jul_data, aug_data, sep_data]

fig = plt.figure()

ax = fig.add_subplot(111)

ax.boxplot(data)

plt.xticks([1, 2, 3, 4, 5], ['May', 'Jun', 'Jul', 'Aug', 'Sep'])

plt.xlabel('Months between the years of 1930-1958')

plt.ylabel('THE VALUES IN TENTH DEGREE CELCIUS FOR EMXT')

ax.set_title('BOXPlots Graph for Extreme Maximum Temperatures')

fig.savefig('step4_5_means.png')

print ('')

####### Step 5: Plot boxplots to evaluate any significant differences (3 Means).

##----------------------------------------------------------------------------------------------------------------

print ('Boxplots for three population means - Step 5 (NOTE: Boxplots will be saved in a file called step5_3_means.png)')

import pandas as pd

import matplotlib

matplotlib.use('agg')

import matplotlib as mpl

import matplotlib.pyplot as plt

jul_data = manchesterweather.loc[manchesterweather['Month'] == 7]['EMXP']

aug_data = manchesterweather.loc[manchesterweather['Month'] == 8]['EMXP']

sep_data = manchesterweather.loc[manchesterweather['Month'] == 9]['EMXP']

data = [jul_data, aug_data, sep_data]

fig = plt.figure()

ax = fig.add_subplot(111)

ax.boxplot(data)

plt.xticks([1, 2, 3], ['Jul', 'Aug', 'Sep'])

fig.savefig('step5_3_means.png')

Please can someone please help me create a bargraph thank you

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions

Question

Why is it important for the auditor to audit the payroll cycle?

Answered: 1 week ago