Creating plots using pandas DataFrames
Most of the data that you will work with will be available in the CSV or Excel formats and thus you will inevitably convert them into a pandas DataFrame in order to work with them effectively. Bokeh extends its functionality to help us build interactive yet meaningful plots using a pandas DataFrame in Python. In this section, we will construct scatter plots and time series plots using a pandas DataFrame.
For this section, we will be using a popular dataset about the stock market found on Kaggle that can be accessed via this link: Kaggle S&P 500 stock data
(https://www.kaggle.com/camnugent/sandp500/data).
As a first step, let's load the dataset into Jupyter Notebook. We can do this using the code shown here:
#Importing the required packages import pandas as pd #Read in the data df = pd.read_csv('all_stocks_5yr.csv') #Filtering for apple stocks df_apple = df[df['Name'] == 'AAL'] #Converting the date column to a time series df_apple['date'] =...