Wrapping Long Column Names in Deepnote

39 Views Asked by At

I am working with data that requires long column names for a report and I can't seem to a method to wrap a column name. Below is an example of the code I'm using. It works for Jupyter Notebook but not in Deepnote. Was wondering if any one has any suggestions on how I can wrap a column name in the header so I can fit the entire table in a published report. Thank you in advanced for the help!!

Output:

enter image description here

Intended Output:

enter image description here

Code Used:

data = [{'Super Long Column Header Name': 'A', 'Some Random Number Here': 100, 'Another Really Long Column Header Name': 20},
         {'Super Long Column Header Name': 'B',  'Some Random Number Here': 70, 'Another Really Long Column Header Name': 25},
         {'Super Long Column Header Name': 'C',  'Some Random Number Here': 200,  'Another Really Long Column Header Name': 39 }]
  
df = pd.DataFrame.from_dict(data)
df = df.style.set_table_styles([dict(selector="th",props=[('max-width', '150px')])]).format(format_dict)
df
0

There are 0 best solutions below