Question

In: Computer Science

Question: How many days there was a 9am humidity level that reached above 80%, somewhere among...

Question:

How many days there was a 9am humidity level that reached above 80%, somewhere among all the weather stations in our dataset. Use the climate_data_Dec2017.csv file and make sure you don't count the same day more than once.

Partial Dataset for climate_data_Dec2017.csv:

Date,State,City,Station Code,Minimum temperature (C),Maximum temperature (C),Rainfall (mm),Evaporation (mm),Sunshine (hours),Direction of maximum wind gust,Speed of maximum wind gust (km/h),9am Temperature (C),9am relative humidity (%),3pm Temperature (C),3pm relative humidity (%)
2017-12-25,VIC,Melbourne,086338,15.1,21.4,0,8.2,10.4,S,44,17.2,57,20.7,54
2017-12-25,VIC,Bendigo,081123,11.3,26.3,0,,,ESE,46,17.2,53,25.5,25
2017-12-25,QLD,Gold Coast,040764,22.3,35.7,0,,,SE,59,29.2,53,27.7,67
2017-12-25,SA,Adelaide,023034,13.9,29.5,0,10.8,12.4,SE,43,18.6,42,27.7,17
2017-12-25,QLD,Brisbane,040913,22.5,36.2,0,11.0,10.0,WSW,61,29.5,53,32.3,53
2017-12-25,QLD,Townsville,032040,24.8,32.5,0,,,NNE,41,29.1,55,31.1,48
2017-12-25,QLD,Cairns,031011,20.3,33.3,0,,,E,41,29.2,59,32.4,45
2017-12-25,NSW,Wollongong,068228,15.9,21.3,7.6,,,SSW,48,18.5,80,19.5,70
2017-12-25,NSW,Newcastle,061055,19.8,21.6,0.6,,,S,48,20.2,83,20.9,74
2017-12-25,VIC,Ballarat,089002,8.5,21.4,0,,,SSE,54,13.3,62,21.1,40
2017-12-25,QLD,Sunshine C,040861,20.2,31.5,0,,,NNE,43,28.9,62,28.8,61
2017-12-25,NSW,Canberra,070351,13.4,23.0,0,,,ESE,39,15.0,66,21.9,47
2017-12-25,NSW,Albury,072160,14.7,29.1,0,,,SSE,37,18.7,42,26.6,32
2017-12-25,QLD,Toowoomba,041529,19.5,32.0,0,,,E,61,24.4,68,31.2,39
2017-12-25,VIC,Geelong,087184,14.1,21.6,0,,,S,41,16.7,58,19.9,53
2017-12-25,NT,Darwin,014015,24.0,27.6,20.0,6.6,0.0,NNE,46,25.4,91,27.3,81
2017-12-25,WA,Perth,009021,19.7,33.1,0,11.0,13.3,SW,39,27.8,34,31.1,29
2017-12-26,VIC,Ballarat,089002,10.8,29.1,0,,,SE,56,17.3,59,27.1,30
2017-12-26,NSW,Canberra,070351,10.8,22.4,0,,,E,39,18.3,57,21.8,48
2017-12-26,QLD,Brisbane,040913,19.0,29.7,54.8,12.4,7.5,E,26,25.2,77,28.8,56
2017-12-26,NSW,Newcastle,061055,18.5,22.5,3.8,,,SE,43,21.1,76,21.7,79
2017-12-26,SA,Adelaide,023034,18.0,33.3,0,11.4,12.7,E,43,25.7,23,28.6,28
2017-12-26,QLD,Toowoomba,041529,16.4,28.4,0,,,E,74,23.9,65,22.7,79
2017-12-26,WA,Perth,009021,15.4,27.4,0,9.0,13.2,SW,41,22.3,59,25.7,45
2017-12-26,VIC,Bendigo,081123,12.8,31.3,0,,,SE,41,20.5,50,30.3,27
2017-12-26,QLD,Gold Coast,040764,20.4,27.9,11.6,,,SSE,52,24.7,87,25.8,81
2017-12-26,VIC,Geelong,087184,12.5,26.6,0,,,SSE,31,18.9,69,23.8,50
2017-12-26,VIC,Melbourne,086338,12.5,30.5,0,8.0,12.9,SSE,37,17.4,66,27.0,43
2017-12-26,QLD,Cairns,031011,22.0,33.0,0,,,ENE,33,29.2,61,31.1,56
2017-12-26,NSW,Wollongong,068228,17.8,24.1,0,,,ENE,41,21.3,59,23.9,55
2017-12-26,QLD,Sunshine C,040861,19.9,28.6,7.4,,,ESE,33,28.4,67,27.6,68
2017-12-26,QLD,Townsville,032040,23.4,32.4,0,,,NE,37,29.9,52,30.4,50
2017-12-26,NSW,Albury,072160,14.0,30.7,0,,,NNE,31,21.6,46,29.2,26
2017-12-26,NT,Darwin,014015,24.6,31.6,8.0,4.6,1.4,NNW,56,26.7,90,30.3,72
2017-12-27,WA,Perth,009021,14.5,26.5,0,11.8,12.3,SSW,54,21.4,49,25.5,34
2017-12-27,NSW,Wollongong,068228,18.8,25.1,0,,,NE,43,21.8,77,23.3,72
2017-12-27,VIC,Geelong,087184,14.9,37.2,0,,,N,41,26.4,46,35.9,20
2017-12-27,QLD,Sunshine C,040861,21.5,28.8,1.4,,,SE,33,26.5,73,27.6,66

Coding language is python

Expected output (print it out):

There were 6 days with 9am humidity levels over 80%.

Solutions

Expert Solution

If you have any doubts, please give me comment...

Code:

myDict = {}

isFirstLine = True

tot = 0

count = 0

ans = 0

for rows in open("climate_data_Dec2017.csv"):

if isFirstLine:

isFirstLine = False

else:

columns = rows.strip("\n").split(",")

date = columns[0]

station = columns[3]

humid = float(columns[12])

if humid>80:

if date not in myDict:

myDict[date] = []

myDict[date].append(humid)

tot += humid

ans = len(myDict)

print("There were "+str(ans)+" days with 9am humidity level over 80%.")


Related Solutions

For many florists, the days leading up to Valentine's Day are among the busiest of the...
For many florists, the days leading up to Valentine's Day are among the busiest of the year. An owner of a florist wanted to estimate the average sale amount for all sales made on the day before Valentine's Day, February 13th. When she had time she wrote down the sale price of a transaction of fresh flowers on a sheet of paper. By 3pm she had collected n=41 sale prices of all flower sales that were made day. The variable...
The 2010 General Social Survey asked the question: “For how many days during the past 30...
The 2010 General Social Survey asked the question: “For how many days during the past 30 days was your mental health, which includes stress, depression, and problems with emotions, not good?” Based on responses from 1,151 US residents, the survey reported a 95% confidence interval of 3.40 to 4.24 days in 2010. (a) Interpret this interval in the context of the data. (b) What does “95% confidence” mean? Explain in the context of the application. (c) Suppose the researchers think...
The 2010 General Social Survey asked the question: "For how many days during the past 30...
The 2010 General Social Survey asked the question: "For how many days during the past 30 days was your mental health, which includes stress, depression, and problems with emotions, not good?" Based on responses from 1,151 US residents, the survey reported a 95% confidence interval of 3.40 to 4.24 days in 2010. (a) Interpret this interval in context of the data. 95% of surveys will report a mean number of ''not good'' days in the past 30 is between 3.40...
40 individuals were surveyed and asked the following question: How many days a week do you...
40 individuals were surveyed and asked the following question: How many days a week do you typically exercise? The table below shows the responses. Use the following table to answer the questions below. Names How many times a week do you typically exercise? 1 6 2 5 3 6 4 4.5 5 5 6 6 7 5 8 3 9 6 10 4 11 5 12 6 13 4 14 6 15 6 16 3 17 3 18 5 19...
How many days' sales are in Amicable's accounts receivable?
Amicable Wireless, Inc. offers credit terms of 2/10, net 30 for its customers. Sixty percent of Amicable's customers take the 2% discount and pay on day 10. The remainder of Amicable's customers pay on day 30. How many days' sales are in Amicable's accounts receivable?
PLEASE EXPLAIN HOW THESE ANSWERS WERE REACHED 2) P Company purchased land from its 80% owned...
PLEASE EXPLAIN HOW THESE ANSWERS WERE REACHED 2) P Company purchased land from its 80% owned subsidiary at a cost of $400,000 on January 1, 2014. Three years later, on December 31, 2016, P sold the land to an outside entity for $450,000. The subsidiary originally purchased the land at $300,000 on January 1, 2011 from an external entity. Required: A. Prepare all the elimination entries necessary at December 31, 2014 to account for this land. B. Prepare all the...
Describe how the firm sets an efficiency wage above the competitive level. Why are there no...
Describe how the firm sets an efficiency wage above the competitive level. Why are there no market forces forcing the profit-maximizing firm to reduce the wage to the competitive level?
deshiscence is most likely to occur how many days post-operatively?
deshiscence is most likely to occur how many days post-operatively?
Question 1: Proficient-level: There are several important functions performed in an organization, among which accounting is...
Question 1: Proficient-level: There are several important functions performed in an organization, among which accounting is one of them. Define the accounting function and discuss how it differs from double-entry bookkeeping. What types of information are critical to the performance of the accounting function in an organization? Distinguished-level: What are the three groups of functions performed by accountants? Discuss the activities that are part of each group. Question 2: Proficient-level: There are many opportunities available for careers in the accounting...
question 14 If faculty rank and evaluation are independent, how many assistant professors would have been expected to receive above average evaluations?
Questions 14 through 18 refer to the following: The following table is a summary of randomly chosen student evaluations of faculty at a university over a three-year period. The researcher is interested in whether the distribution of evaluations differs by faculty rank. Rank Evaluation Assistant Professor Associate Professor Professor Total Above Average 44 39 36 119 Below Average 36 31 54 121 Total 80 70 90 240 question 14 If faculty rank and evaluation are independent, how many assistant professors...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT