import numpy as np
import matplotlib.pyplot as plt! [Image][1]
data = np.genfromtxt ("cement production.csv",delimiter=',')
print(data[3:,])
x = data[3:,0]
y = data[3:,0]
for col in range(1,7):
plt.plot(x,data[3:,col])
plt.title("The annual cement output")
plt.xlabel('year')
plt.ylabel('quantity')
plt.show()
I printed out the data in cement production.
Excel data are
year, Korea, Russia, Romania, Mexico, Morocco, United States
2012,52,613,61,536,8,82
2013,53,818,66,648,7,451
2014,52,490,68,600,7,621
2015,56,212,62,97,8,424
2016,61,551,55,42,8,38
2017,62,639,54,678,8,438
I want to get the average growth rate or MAX point, such as Korea and the United States, but I don't know the code
From this printed graph value, I want to get the MAX point for each curve because it's the average growth rate.
And I also want to try dividing colors by each city.
python excel
import numpy as np
import matplotlib.pyplot as plt
data = np.genfromtxt ("cement production.csv",delimiter=',')
print(data[3:,])
x = data[3:,0]
y = data[3:,0]
for col in range(1,7):
plt.plot(x,data[3:,col])
plt.title("The annual cement output")
plt.xlabel('year')
plt.ylabel('quantity')
plt.show()
This is the code. Excel data are
Korea, Russia, Romania, Mexico, Morocco, and the United States
2012 52 613 61 536 8 82
2013 53 818 66 648 7 451
2014 52 490 68 600 7 621
2015 56 212 62 97 8 424
2016 61 551 55 42 8 38
2017 62 639 54 678 8 438
I want to get the average growth rate or MAX point, such as Korea and the United States, but I don't know the code
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
plt.rc("font", family="D2Coding")
df = pd.read_csv('data/data.csv')
df_melted = df.melt (id_vars='year', var_name='country', value_name='production')
sns.lineplot (data=df_melted, x='year', y='production', hue='country')
plt.legend(bbox_to_anchor=(1.02, 1), loc=2, borderaxespad=0.)
© 2025 OneMinuteCode. All rights reserved.