Robyn
Robyn

Reputation: 11

Pandas Dataframe Display missing gridlines (Jupyter Notebook)

For some reason, whenever I create a dataframe in pandas from reading in data from a file, I don't have gridlines:

my_dataframe_display

I have checked my settings for pd.options for all display attributes and everything was set to the default. Can anyone help me change the formatting of my dataframe? This format happens even when I open new python notebooks within jupyter notebook.

Upvotes: 1

Views: 3376

Answers (1)

yoonghm
yoonghm

Reputation: 4645

Add this and run from a cell

%%HTML
<style type="text/css">
table.dataframe td, table.dataframe th {
    border: 1px  black solid !important;
  color: black !important;
}

Use df instead of print(df)

Source: answer by MEdwin here Python Jupyter Notebook print dataframe borders

Upvotes: 1

Related Questions