Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,29 +61,10 @@ def asubmit(aparam):
|
|
| 61 |
adf3 = pd.read_csv(StringIO(csvString), sep=",")
|
| 62 |
aparam["acontainer"].dataframe(adf3)
|
| 63 |
|
| 64 |
-
if ("0" == "mycustom"):
|
| 65 |
-
import matplotlib.pyplot as plt
|
| 66 |
-
xpoints = np.array(adf3['Date'])
|
| 67 |
-
ypoints = np.array(adf3['Celsius'])
|
| 68 |
-
plt.plot(xpoints, ypoints, 1)
|
| 69 |
-
plt.xlabel('Date')
|
| 70 |
-
plt.ylabel('Celsius')
|
| 71 |
-
plt.show()
|
| 72 |
-
|
| 73 |
from sklearn.linear_model import LinearRegression
|
| 74 |
# Creating a Linear Regression model on our data
|
| 75 |
lin = LinearRegression()
|
| 76 |
lin.fit(adf3[['Date']].astype('float').astype('int32'), adf3['Celsius'])
|
| 77 |
-
# lin.fit(pd.to_numeric(adf3[['Date']]), adf3['Celsius'])
|
| 78 |
-
|
| 79 |
-
# Creating a plot
|
| 80 |
-
ax = adf3.plot.scatter(x='Date', y='Celsius', alpha=.1)
|
| 81 |
-
ax.plot(adf3['Date'], lin.predict(adf3[['Date']]), c='r')
|
| 82 |
-
|
| 83 |
-
# lin.score(adf3[['Date']], adf3['Celsius'])
|
| 84 |
-
# st.write(lin.predict(np.array([[20230223]])))
|
| 85 |
-
# st.write(lin.predict(np.array([['Date']], dtype='int32')))
|
| 86 |
-
# st.write(lin.predict(adf3[['Date']]))
|
| 87 |
|
| 88 |
atrendproject = [20230223,]
|
| 89 |
st.write(type(lin.predict(np.array([atrendproject]))))
|
|
|
|
| 61 |
adf3 = pd.read_csv(StringIO(csvString), sep=",")
|
| 62 |
aparam["acontainer"].dataframe(adf3)
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
from sklearn.linear_model import LinearRegression
|
| 65 |
# Creating a Linear Regression model on our data
|
| 66 |
lin = LinearRegression()
|
| 67 |
lin.fit(adf3[['Date']].astype('float').astype('int32'), adf3['Celsius'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
atrendproject = [20230223,]
|
| 70 |
st.write(type(lin.predict(np.array([atrendproject]))))
|