0

A generalized recreation of the table I'm having issues with, which will come out being a table with 12000 rows and a MultiIndex. The big issue: I can't get this table to display in a rendered version of a Jupyter Notebook.

import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randn(12000, 6), columns=list('ABCDCD'))

second_cols = ([''] * 2) + ['X', 'X', 'Y', 'Y']
df.columns = pd.MultiIndex.from_arrays([df.columns,second_cols])
df = df.swaplevel(0,1,1).sort_index(1)
df

My company uses proprietary software that lets us turn an .ipynb file into a interactive report. However, most of my issues are Jupyter notebook-level. Here's what I've tried and what's happened:

  1. Just display df: The tables print out, but only show rows [0:29, 19930:12000] and there is no sorting available.
  2. display(HTML(df.to_html())): gives me the following error:

    IOPub data rate exceeded. The notebook server will temporarily stop sending output to the client in order to avoid crashing it. To change this limit, set the config variable --NotebookApp.iopub_data_rate_limit.

  3. DataViz and GoogleCharts do not support MultiIndexes.

Any ideas to make my dataframe render?! Perhaps packages that can paginate my table, etc? Note the big issue here is the MultiIndex.

  • Possible duplicate of [Is there a way to (pretty) print the entire Pandas Series / DataFrame?](https://stackoverflow.com/questions/19124601/is-there-a-way-to-pretty-print-the-entire-pandas-series-dataframe) – ALollz Mar 26 '18 at 18:15
  • @ALollz, this question is specifically about rendering a MultiIndexed dataframe and the struggles to print them, not just a generic Series/DF :) – Cassie Lebauer Mar 26 '18 at 18:19

0 Answers0