最後活躍 1715848996

sujal's Avatar sujal 已修改 1715848996. 還原成這個修訂版本

1 file changed, 17 insertions

q28.py(檔案已創建)

@@ -0,0 +1,17 @@
1 + # Create a .csv file (with contents like age, weight and BMI). Read the content of the file and using Pandas and
2 + # MatPlotLib, plot the graph.
3 +
4 + import numpy as np
5 + import pandas as pd
6 + import matplotlib.pyplot as plt
7 +
8 + data = pd.read_csv("data.csv")
9 + bmi = []
10 + for row in data.iterrows():
11 + age, weight, height = row[1]
12 + bmi.append(weight / (height / 100) ** 2)
13 + data["BMI"] = bmi
14 +
15 + figure, ax = plt.subplots()
16 + ax.plot(data["age"], data["BMI"], "ro")
17 + plt.show()
上一頁 下一頁