Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

https://www.chegg.com/homework-help/questions-and-answers/q108545039?utm_source=Adobe&utm_medium=email&utm_campaign=cheggQuestionAnswered&utm_source=Braze&utm_medium=email&utm_campaign=MC_CS_Trn_YourQuestionAnswered_EML_0-P1&utm_content=MC_CS_Trn_YourQuestionAnswered_EML_0-P1 I asked this previous problem that I have and when I changed it the program said: ValueError: invalid literal for int() with base 10:

https://www.chegg.com/homework-help/questions-and-answers/q108545039?utm_source=Adobe&utm_medium=email&utm_campaign=cheggQuestionAnswered&utm_source=Braze&utm_medium=email&utm_campaign=MC_CS_Trn_YourQuestionAnswered_EML_0-P1&utm_content=MC_CS_Trn_YourQuestionAnswered_EML_0-P1

I asked this previous problem that I have and when I changed it the program said: ValueError: invalid literal for int() with base 10: 'Year'

Do you know why is this happening and how can I fix it so that I can solve my problem?

my Code:

import matplotlib.pyplot as plt

NOLA_FILE = "nola_weather_feb.csv"

years = [] high_temperature = [] low_temperature = []

with open(NOLA_FILE, "r") as file: for line in file: year, max_temp, min_temp, mean, humidity = line.strip().split(",") years.append(int(year)) high_temperature.append(int(max_temp)) low_temperature.append(int(min_temp))

highest_temperature_year = years[high_temperature.index(max(high_temperature))] highest_temperature = max(high_temperature)

plt.scatter(years, high_temperature, color="red", label="High Temperature") plt.scatter(years, low_temperature, color="blue", label="Low Temperature") plt.scatter(highest_temperature_year, highest_temperature, color="orange", marker="X", s=200)

plt.title("Temperature of Mardi Gras in New Orleans (1922-2022)") plt.xlabel("Year") plt.ylabel("Temperature in Fahrenheit") plt.legend()

pos = [i for i in range(0, len(years), 5)] years_range = range(1920, 2030, 5) plt.xticks(pos, years_range, rotation=45)

plt.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

Students also viewed these Databases questions