- Let's read in stock data for 2016, 2017, and 2018 into a list of DataFrames using a loop instead of three different calls to the read_csv function. Jupyter notebooks currently only allow a single DataFrame to be displayed on one line. However, there is a way to customize the HTML output with help from the IPython library. The user-defined display_frames function accepts a list of DataFrames and outputs them all in a single row:
>>> from IPython.display import display_html>>> years = 2016, 2017, 2018>>> stock_tables = [pd.read_csv('data/stocks_{}.csv'.format(year), index_col='Symbol') for year in years]>>> def display_frames(frames, num_spaces=0): t_style = '<table style="display: inline;"' tables_html = [df.to_html().replace('<table', ...