df.head() sometimes doesn't work in Pandas, Python

后端 未结 3 838
故里飘歌
故里飘歌 2020-12-09 09:55

I\'m a beginner in Python and the Pandas library, and I\'m rather confused by some basic functionality of DataFrame. I\'ve got a pandas DataFrame as below:



        
3条回答
  •  悲哀的现实
    2020-12-09 10:24

    df.head(n) returns a DataFrame holding the first n rows of df. Now to display a DataFrame pandas checks by default the width of the terminal, if this is too small to display the DataFrame a summary view will be shown. Which is what you get in the second case.

    Could you increase the size of your terminal, or disable autodetect on the columns by pd.set_printoptions(max_columns=10)?

提交回复
热议问题