Install:
Installinstall matplotlib # Check out of the doc from site
ImportPandas as PDImportMatplotlib.pyplot as Plt fromNumPyImportmeandefload_df (symbol): return pd.read_csv ("data/{0}.csv". Format (symbol)) defget_max_close (symbol):"""Return The maximum closing value for stock idicicated by symbol. Note:data for a stock are stored in File:data/<symbol>.csv"""DF=load_df (symbol)returndf["Close"].max ()defget_mean_volume (symbol): DF=load_df (symbol)returnMean (df['Volume'])defprintadjclose (): DF= Pd.read_csv ('Data/ibm.csv') df[[ 'low', 'high']].plot () plt.show () defTest_run ():"""Function called by Test Run""" forSymbolinch['AAPL','IBM']: Print("Max Close") Print(symbol, get_max_close (symbol))Print("Mean Volume") Print(symbol, get_mean_volume (symbol))if __name__=="__main__": Test_run () printadjclose ()
[Python] Read and plot data from CSV file