Pretty-print an entire Pandas Series / DataFrame

后端 未结 12 2401
再見小時候
再見小時候 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:09

    Sure, if this comes up a lot, make a function like this one. You can even configure it to load every time you start IPython: https://ipython.org/ipython-doc/1/config/overview.html

    def print_full(x):
        pd.set_option('display.max_rows', len(x))
        print(x)
        pd.reset_option('display.max_rows')
    

    As for coloring, getting too elaborate with colors sounds counterproductive to me, but I agree something like bootstrap's .table-striped would be nice. You could always create an issue to suggest this feature.

提交回复
热议问题