How to shift whole pandas dataframe to right in jupyter notebook?

Viewed 183

When jupyter notebook/lab displays the dataframe it is always left-aligned. I want to shift the whole dataframe-structure position to some units to the right. What code do I have to add to get the required changes (i.e. to shift my dataframe position) ?

enter image description here

1 Answers

Just inspect the element. The element is Out[]: output_subarea .

Write your own css.

Try:

from IPython.display import display, HTML

CSS = """
.output_subarea {
  margin-left:100px;
}
"""

HTML('<style>{}</style>'.format(CSS))

display(df)

enter image description here

update:

Do it in this way(in one cell define them):

display(HTML('<style>{}</style>'.format(CSS)))
display(df)
Related