Microsoft Stock Closing Price Analysis PDF

Summary

This document contains Python code analyzing Microsoft stock closing prices. It uses libraries like pandas and matplotlib to create box plots and histograms. The data is loaded from a CSV file and visualized to understand price distributions.

Full Transcript

IMPORTING LIBRARIES **import numpy as np** **import pandas as pd** **import matplotlib.pyplot as plt** **LOADING DATASET** **df=pd.read\_csv(\"D:/tsa\_107/data/Microsoft\_Stock.csv\")** **HANDLING DATA** **print(df.describe())** **Open High Low Close Volume** **count 1511.000000 1511.000000...

IMPORTING LIBRARIES **import numpy as np** **import pandas as pd** **import matplotlib.pyplot as plt** **LOADING DATASET** **df=pd.read\_csv(\"D:/tsa\_107/data/Microsoft\_Stock.csv\")** **HANDLING DATA** **print(df.describe())** **Open High Low Close Volume** **count 1511.000000 1511.000000 1511.000000 1511.000000 1.511000e+03** **mean 107.385976 108.437472 106.294533 107.422091 3.019863e+07** **std 56.691333 57.382276 55.977155 56.702299 1.425266e+07** **min 40.340000 40.740000 39.720000 40.290000 1.016120e+05** **25% 57.860000 58.060000 57.420000 57.855000 2.136213e+07** **50% 93.990000 95.100000 92.920000 93.860000 2.662962e+07** **75% 139.440000 140.325000 137.825000 138.965000 3.431962e+07** **max 245.030000 246.130000 242.920000 244.990000 1.352271e+08** **DATA VISUALIZATION** **plt.figure(figsize=(10, 8))** **plt.boxplot(df\[\'Close\'\], vert=False)** **plt.title(\'Box Plot of Microsoft Stock Closing Price\')** **plt.xlabel(\'Closing Price (\$)\') plt.show()** **NULL VALUES** **Date 0** **Open 0** **High 0** **Low 0** **Close 0** **Volume 0** **dtype: int64** **PLOTTING DATA** **plt.figure(figsize=(8, 6))** **plt.hist(df\[\'Close\'\], bins=20, color=\'purple\', edgecolor=\'black\')** **plt.title(\'Distribution of Microsoft Stock Closing Prices\')** **plt.xlabel(\'Closing Price (\$)\')** **plt.ylabel(\'Frequency\')** **plt.grid(True)** **plt.show()** ![](media/image2.png)