Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# importing pandas library
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import pandas as pd
|
| 4 |
-
# creating and initializing a nested list
|
| 5 |
inp_list = [[13,0,8425333,'Asia'],[15,1,9712569,'Oceania'],[52,0,76039390,'Americas'],[2,0,637408000,'Asia'],[35,1,44310863,'Europe'],[20,0,3.72e+08,'Asia'],[45,1,171984000,'Americas']]
|
| 6 |
mypredictions = [1,1,0,0,1,0,1]
|
| 7 |
# creating a pandas dataframe
|
|
@@ -10,9 +10,15 @@ df = pd.DataFrame(inp_list,columns=['week','diabetes_binary','Population','Conti
|
|
| 10 |
df2=df.sort_values(by=['week'],ascending=True)
|
| 11 |
X = list(df2.iloc[:, 0])
|
| 12 |
Y = mypredictions
|
|
|
|
| 13 |
plt.plot(X, Y, 'o-g')
|
| 14 |
plt.title("Diabetes prediction graph")
|
| 15 |
plt.xlabel("week")
|
| 16 |
plt.ylabel("diabetes_binary")
|
|
|
|
|
|
|
|
|
|
| 17 |
# Show the plot
|
| 18 |
plt.show()
|
|
|
|
|
|
|
|
|
| 1 |
# importing pandas library
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import pandas as pd
|
| 4 |
+
# creating and initializing a nested list
|
| 5 |
inp_list = [[13,0,8425333,'Asia'],[15,1,9712569,'Oceania'],[52,0,76039390,'Americas'],[2,0,637408000,'Asia'],[35,1,44310863,'Europe'],[20,0,3.72e+08,'Asia'],[45,1,171984000,'Americas']]
|
| 6 |
mypredictions = [1,1,0,0,1,0,1]
|
| 7 |
# creating a pandas dataframe
|
|
|
|
| 10 |
df2=df.sort_values(by=['week'],ascending=True)
|
| 11 |
X = list(df2.iloc[:, 0])
|
| 12 |
Y = mypredictions
|
| 13 |
+
# Plot the data using bar() method
|
| 14 |
plt.plot(X, Y, 'o-g')
|
| 15 |
plt.title("Diabetes prediction graph")
|
| 16 |
plt.xlabel("week")
|
| 17 |
plt.ylabel("diabetes_binary")
|
| 18 |
+
for i in range(len(X)):
|
| 19 |
+
b=str(X[i])+","+str(Y[i])
|
| 20 |
+
plt.annotate(b, xy=(X[i],Y[i]))
|
| 21 |
# Show the plot
|
| 22 |
plt.show()
|
| 23 |
+
|
| 24 |
+
|