Я только начал с Python, и я пытаюсь проанализировать некоторые данные, в настоящее время цель - это график, где Y - общее количество, а X - год.
Я пытался найти людей с похожими проблемами, но безуспешно. Я пытался читать по массивам и даже пробовал свои силы в 2D-массивах, но безуспешно.
for row in csv.reader:
if line_count == 0:
print(f'Comumn names are {", ".join(row)}')
line_count += 1
elif line_count <= 1000:
print(f"\t{row[0]} is the country and {row[1]} the year. The
sex was {row[2]}.")
t = f"\t{row[0]} is the country and {row[1]} the year. The
sex was {row[2]}."
if " male" in t:
males += 1
elif "female" in t:
females += 1
else:
none += 1
line_count += 1
else:
break
def stat():
if "198" in line_count(row[1]):
total[0] += 1
elif "199" in line_count(row[1]):
total[1] += 1
elif "200" in line_count(row[1]):
total[2] += 1
elif "201" in line_count(row[1]):
total[3] += 1
elif "202" in line_count(row[1]):
total[4] += 1
Проблема в том, что мой matplotlib использует plt.plot ()
Я пытаюсь сделать что-то вроде:
plt.plot(years, currentDecadenDeaths)
years = [1980, 1990, 2000, 2010, 2020]
currentDecadenDeaths = [[years[0],[years[1],[years[2],[years[3],
[years[4], [total[0], total[1], total[2], total[3], total[4]]]
plt.plot(years, currentDecadenDeaths)