Pretty-print an entire Pandas Series / DataFrame

后端 未结 12 2176
再見小時候
再見小時候 2020-11-22 03:26

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 res

12条回答
  •  不思量自难忘°
    2020-11-22 04:00

    Try using display() function. This would automatically use Horizontal and vertical scroll bars and with this you can display different datasets easily instead of using print().

    display(dataframe)
    

    display() supports proper alignment also.

    However if you want to make the dataset more beautiful you can check pd.option_context(). It has lot of options to clearly show the dataframe.

    Note - I am using Jupyter Notebooks.

提交回复
热议问题