sujal revisou este gist . Ir para a revisão
1 file changed, 17 insertions
q28.py(arquivo criado)
@@ -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() |
Próximo
Anterior