We are interested in finding outlier temperatures and comparing t run average.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
We are interested in finding outlier temperatures and comparing them to the long
run average.
Start a new program temp_file_stats.py from your working version of
read_temp_file.py. Comment out the line that prints out the year and temperature
for each year in the file.
Add code to find the minimum and maximum temperature for all of the years in
the file and the years they occured in. You can base your solution on the
starbucks_menu.py program we went over in lecture. Here is a transcript of how
the program should work:
Temperature anomaly filename:SacramentoTemps.csv
Min temp: -2.32 in 1913
Max temp: 2.99 in 1889
Transcribed Image Text:We are interested in finding outlier temperatures and comparing them to the long run average. Start a new program temp_file_stats.py from your working version of read_temp_file.py. Comment out the line that prints out the year and temperature for each year in the file. Add code to find the minimum and maximum temperature for all of the years in the file and the years they occured in. You can base your solution on the starbucks_menu.py program we went over in lecture. Here is a transcript of how the program should work: Temperature anomaly filename:SacramentoTemps.csv Min temp: -2.32 in 1913 Max temp: 2.99 in 1889
Sacramento
Year Value
1880
-1.56
1881
-0.08
1882
-0.3
1883
-1.44
1884
-2.29
1885 -1.95
1886
-0.63
1887
0.63
1888
-0.72
1889
2.99
1890
-0.5
1891
-1.36
1892
1.03
1893
-0.16
1894
-0.01
1895 -1.46
1896
-1.23
1897
-0.83
1898
-0.91
1899
1.53
1900
1.08
1901
0.24
1902 -1.08
1903
-1.1
1904 -0.83
1905
-0.31
Transcribed Image Text:Sacramento Year Value 1880 -1.56 1881 -0.08 1882 -0.3 1883 -1.44 1884 -2.29 1885 -1.95 1886 -0.63 1887 0.63 1888 -0.72 1889 2.99 1890 -0.5 1891 -1.36 1892 1.03 1893 -0.16 1894 -0.01 1895 -1.46 1896 -1.23 1897 -0.83 1898 -0.91 1899 1.53 1900 1.08 1901 0.24 1902 -1.08 1903 -1.1 1904 -0.83 1905 -0.31
Expert Solution
Step 1

SOURCE CODE

#!/usr/bin/python3
import csv

CSV_FILE = input("Temperature anomaly file name:")

with open(CSV_FILE) as csv_file:
    csv_reader = csv.reader(csv_file, delimiter=',')
    row_1=next(csv_reader)
    max=float(row_1[1])
    min=float(row_1[1])
    max_Y=row_1[0]
    min_y=row_1[0]

    for row in csv_reader:
        if float(row[1])<min:
            min=float(row[1])
            min_y=row[0]
        if float(row[1])>max:
            max=float(row[1])
            max_y=row[0]
    print("Min temp:", min," in ",min_y)
    print("Max temp:", max," in ",max_y)

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Random variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education