0

I am trying to display a dataframe in a friendly way using df.to_html() using the following code:

import pandas as pd
# Friendely HTML Display
from IPython.display import display, HTML
sales = [{'account': 'Jones LLC', 'Jan': 150, 'Feb': 200, 'Mar': 140},
     {'account': 'Alpha Co',  'Jan': 200, 'Feb': 210, 'Mar': 215},
     {'account': 'Blue Inc',  'Jan': 50,  'Feb': 90,  'Mar': 95 }]

df = pd.DataFrame(sales)
print(df.to_html())

However, the results are displayed as in unrendered xml format

enter image description here

2
  • I think you need this Commented Jan 10, 2018 at 11:21
  • What's wrong with just df as last line in a cell? Commented Jan 10, 2018 at 11:23

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.