How do I expand the output display to see more columns of a pandas DataFrame?

后端 未结 19 1656
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-22 00:37

Is there a way to widen the display of output in either interactive or script-execution mode?

Specifically, I am using the describe() function on a pand

19条回答
  •  旧时难觅i
    2020-11-22 00:55

    You can use this custom function for displaying things for pandas Dataframe.

    def display_all(df):     # for any Dataframe df
       with pd.option_context('display.max_rows',1000): # change number of rows accordingly
          with pd.option_context('display.max_columns',1000): # change number of columns accordingly
              display(df)
    

    display_all(df.head()) # pass this function to your dataframe and Voila!

    You don't have use pd.set_option for whole notebook just use for single cell.

提交回复
热议问题