# File: weatherPlotter.py # # Plots minimum and maximum weather data. # Assumes CSV input has the following columns: # - NAME (e.g., "MINNEAPOLIS ST. PAUL INTERNATIONAL AIRPORT") # - DATE (e.g., "1/19/2023") # - PRCP (e.g., "0.16) <- string representing a float # - SNOW (e.g., "3.5") <- string representing a float # - TMAX (e.g., "32") <- string representing an int # - TMIN (e.g., "27") <- string representing an int # # Author: TODO # # Collaboration statement: TODO # # Inputs: CSV file import matplotlib.pyplot as plt def parseData(filename): """ Opens the CSV file with name filename for reading, and reads in the data. filename: string returns: five lists: - one of dates (strings) - one of precipitation (floats) - one of snow (floats) - one of minimum temps (ints) - one of maximum temps (ints) """ dates = [] precip = [] snow = [] minTemps = [] maxTemps = [] # TODO: Part 0 # copy your A4 parseData code here return dates, precip, snow, minTemps, maxTemps def plotTempData(minTemps, maxTemps): """ Plots both the minimum and maximum temperature for each day in the same plot. """ # TODO: Part 1 pass # replace with your code def main(): # Parse the temperature data into lists of dates, precipitation, # snow, lows, and highs filename = "weatherData.csv" dates, precip, snow, mins, maxes = parseData(filename) # Plot the low/high temperatures on the same axes plotTempData(mins, maxes) # TODO: Part 2 pass # replace with a call to another plotting function if __name__ == "__main__": main()