Update app.py
Browse files
app.py
CHANGED
@@ -14,12 +14,12 @@ def fetch_stock_data(symbol, start_date, end_date):
|
|
14 |
|
15 |
# Function to create features for the model
|
16 |
def create_features(data):
|
17 |
-
data
|
18 |
-
data['Year'] = data
|
19 |
-
data['Month'] = data
|
20 |
-
data['Day'] = data
|
21 |
-
data['Hour'] = data
|
22 |
-
data['Minute'] = data
|
23 |
|
24 |
return data
|
25 |
|
@@ -62,7 +62,7 @@ def main():
|
|
62 |
model = train_model(stock_data)
|
63 |
|
64 |
# Predict the stock price for a specific date (e.g., the last date in the dataset)
|
65 |
-
prediction_date = stock_data
|
66 |
prediction_features = [[
|
67 |
prediction_date.year,
|
68 |
prediction_date.month,
|
|
|
14 |
|
15 |
# Function to create features for the model
|
16 |
def create_features(data):
|
17 |
+
data.index = pd.to_datetime(data.index) # Convert index to datetime
|
18 |
+
data['Year'] = data.index.year
|
19 |
+
data['Month'] = data.index.month
|
20 |
+
data['Day'] = data.index.day
|
21 |
+
data['Hour'] = data.index.hour
|
22 |
+
data['Minute'] = data.index.minute
|
23 |
|
24 |
return data
|
25 |
|
|
|
62 |
model = train_model(stock_data)
|
63 |
|
64 |
# Predict the stock price for a specific date (e.g., the last date in the dataset)
|
65 |
+
prediction_date = stock_data.index[-1]
|
66 |
prediction_features = [[
|
67 |
prediction_date.year,
|
68 |
prediction_date.month,
|