<jupyter_start><jupyter_text>Tesla Stock Price Prediction with Machine Learning Predicting Stock prices is a great use case of machine learning both for financial and time series analysis. Tesla has been in the eyes of the world for a long time now as governments of so many countries all over the world are supporting the vision of Tesla. So in this article, I will take you through a tutorial on how to use the Facebook Prophet model for the task of stock price prediction of Tesla.The dataset that I will be using here has been downloaded from yahoo finance. To download this dataset simply visit yahoo finance and search for TSLA. You will see a dashboard as shown in the image below<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from fbprophet import Prophet
import os
os.chdir("E:\\PYTHON NOTES\\projects\\100 data science projeect\\tesla stoke price")
data=pd.read_csv("TSLA.csv")
data<jupyter_output><empty_output><jupyter_text>Before moving forward let’s visualize the “Close” column in the dataset which represents close prices of each day:<jupyter_code>close=data["Close"]
ax=close.plot(title="Tesla")
ax.set_xlabel("Date")
ax.set_ylabel("close")<jupyter_output><empty_output><jupyter_text>We only need two columns from this dataset (Date and Close), so let’s create a new DataFrame with only these two columns:<jupyter_code>data["Date"]=pd.to_datetime(data["Date"],infer_datetime_format="True")
data=data[["Date","Close"]]
data<jupyter_output><empty_output><jupyter_text>As we are using the Facebook prophet model here for predicting the stock prices of Tesla so we need to rename the columns<jupyter_code>data=data.rename(columns={"Date":"ds","Close":"y"})
data
model=Prophet()
model.fit(data)
future=model.make_future_dataframe(periods=365)

forcast=model.predict(future)
forcast[["ds","yhat","yhat_lower","yhat_upper"]].tail()
graph=model.plot(forcast,xlabel="Date",ylabel="price")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09266802443991853, 'fraction_numerical': 0.003054989816700611, 'mean_word_length': 7.020408163265306, 'pattern_counts': {'":': 2, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '17227', 'license': 'Apache-2.0', 'n_tokens_mistral': 600, 'n_tokens_neox': 578, 'n_words': 217, 'path': 'tesla stock price.ipynb', 'repo_name': 'ankitkumar0/tesla-stock-price', 'size': '1964'}