This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import required libraries | |
| import pandas as pd | |
| # Read csv file | |
| df = pd.read_csv("medium_data.csv", index_col="id") | |
| # Visualize data frame top rows | |
| df.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create a title for the dashboard | |
| title = pn.pane.Markdown( | |
| """ | |
| # Tesla Stock Analysis Dashboard | |
| """, | |
| width=1000, | |
| ) | |
| # Create a welcome message for the dashboard | |
| welcome = pn.pane.Markdown( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Create an hvplot table for the stock data | |
| TSLA_df_table = TSLA.hvplot.table(width=1000) | |
| # Create an hvplot line plot for the closing price | |
| TSLA_closing_price_plot = TSLA.drop(columns="Daily_Return").hvplot.line(title="TSLA Closing Price & Simple Moving Average", ylabel="USD", height=500, width=1000) | |
| # Create an hvplot line plot for the daily return | |
| TSLA_daily_retrun_plot = TSLA["Daily_Return"].hvplot.line(title="TSLA Daily Returns", ylabel="Daily Return", height=500, width=1000) | |
| # Create an hvplot bar plot for the daily volume |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Select 'Close' column only | |
| TSLA = TSLA_data[["Close"]].copy() | |
| # Add a daily return column | |
| TSLA["Daily_Return"] = TSLA["Close"].pct_change() | |
| # Add a simple moving average column of window of 10 days | |
| TSLA["SMA10"] = TSLA["Close"].rolling(window=10).mean() | |
| # Add a simple moving average column of window of 50 days |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import required libraries | |
| import yfinance as yf | |
| import pandas as pd | |
| import hvplot.pandas | |
| import panel as pn | |
| pn.extension('plotly') | |
| import plotly.express as px | |
| import plotly.graph_objects as go | |
| # Get stock data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import libraries and dependencies | |
| import numpy as np | |
| import pandas as pd | |
| # ------------------------------ Data Set Loading ------------------------------ | |
| # Read data set | |
| df = pd.read_csv('Desktop/file.csv') | |
| # Visualize data set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import dependencies | |
| import pandas as pd | |
| import pyodbc | |
| # Specify credentials | |
| server = '<YOUR SERVER>' | |
| database = '<YOUR DATABASE>' | |
| username = '<YOUR USERNAME>' | |
| password = '<YOUR PASSWORD>' | |
| driver= '{ODBC Driver 17 for SQL Server}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Calculate Cp | |
| Cp = (USL-LSL)/(6*np.std(data)) | |
| # Calculate Cpk | |
| Cpk = min((USL-data.mean())/(3*data.std()), (data.mean()-LSL)/(3*data.std())) | |
| # Calculate z-value | |
| z = min((USL-data.mean())/(data.std()), (data.mean()-LSL)/(data.std())) | |
| # Get data summary statistics |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Import required libraries | |
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| from scipy.stats import norm | |
| # Set specification limits | |
| target = 5 | |
| LSL = 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PROCESS CAPABILITY ANALYSIS | |
| ----------------------------------- | |
| Specifications | |
| Taget: 5 | |
| LSL: 3 | |
| USL: 7 | |
| ----------------------------------- | |
| Indices |