Search code examples
pandasjupyter-notebookipython

Pretty printing Python Pandas Dataframe without header nor Index


I'm trying to pretty print a Pandas dataframe without Header nor index, without success

This pretty prints but prints also header and index

import pandas as pd
from IPython.display import display

data=pd.DataFrame(same_data)
display(data)

enter image description here


This removes index (not header) but does not pretty prints

import pandas as pd
from IPython.display import display, Markdown

data=pd.DataFrame(same_data)
display(Markdown(data.to_markdown(index=False)))

enter image description here

What am I doing wrong?


Solution

  • For those coming here with the same problem, that's how I finally solved it

    import pandas as pd
    from IPython.display import display, HTML
    
    display(HTML(
        ref_signs_table.to_html(
            index=False, 
            header=False, 
            notebook=True
        ).replace('<td>', '<td align="right">')
    ))
    

    enter image description here