1

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.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263
Robyn
  • 11
  • 1
  • 2
  • Did you try updating your JuPyter as suggested on [this](https://stackoverflow.com/questions/45663070/formatting-of-pandas-dataframes-in-jupyter-notebook) similar post? – Sheldore Sep 20 '18 at 21:44

1 Answers1

1

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

Samuel Liew
  • 76,741
  • 107
  • 159
  • 260
yoonghm
  • 4,198
  • 1
  • 32
  • 48