Pretty-print an entire Pandas Series / DataFrame

I work with Series and DataFrames on the terminal a lot. The default __repr__ for a Series returns a reduced sample, with some head and tail values, but the rest missing.

Is there a builtin way to pretty-print the entire Series / DataFrame? Ideally, it would support proper alignment, perhaps borders between columns, and maybe even color-coding for the different columns.

You can also use the option_context, with one or more options:

    with pd.option_context('display.max_rows', None, 'display.max_columns', None):
        print(df)

This will automatically return the options to their default values.

If you are working on jupyter-notebook, using display instead of print will use jupyter rich display logic.

From: stackoverflow.com/q/19124601