Python Forum
Pandas dataframe columns collapsed in Spyder when printing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas dataframe columns collapsed in Spyder when printing
#1
Hello everyone!

I have this tiny problem when using Pandas inside the Spyder IDE. BTW I am still kind of new to Python and libraries so I hope you can forgive me for my beginner question.

So, what I want is to print a preview of a query I made with Google BigQuery (health data). For this, I used

print(df.head(5))
in my script.

However, what I get in the console view is a "collapsed" view of the data frame with columns replaced by dots in the console, like this:

Per stat:
  provider_city  ... average_medicare_payments
0      ABINGTON  ...                   3992.93
1         AKRON  ...                   4292.47
2        ALBANY  ...                   3834.18
3        ALBANY  ...                   5137.31
4     ALLENTOWN  ...                   3913.78
Note the dots replacing the columns. I have seen other examples of this, and in that case the columns were shown in the preview. So is there a way to enable a wider view of the data frame? I have searched on the internet but all the solutions I tried didn't work as intended Huh

What I did in my case was to use tkinter to print the entire sheet instead and look at the data. But since this is kind of irritating doing all the time when working with my data, I would love to hear your opinion on this matter.

Thanks very much in advance!
Reply


Messages In This Thread
Pandas dataframe columns collapsed in Spyder when printing - by UniKlixX - Nov-02-2019, 10:03 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to add columns to polars dataframe sayyedkamran 1 1,687 Nov-03-2023, 03:01 PM
Last Post: gulshan212
  concat 3 columns of dataframe to one column flash77 2 776 Oct-03-2023, 09:29 PM
Last Post: flash77
  HTML Decoder pandas dataframe column mbrown009 3 961 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  Use pandas to obtain cartesian product between a dataframe of int and equations? haihal 0 1,090 Jan-06-2023, 10:53 PM
Last Post: haihal
  Pandas Dataframe Filtering based on rows mvdlm 0 1,396 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  Pandas dataframe: calculate metrics by year mcva 1 2,268 Mar-02-2022, 08:22 AM
Last Post: mcva
  Pandas dataframe comparing anto5 0 1,243 Jan-30-2022, 10:21 AM
Last Post: anto5
  PANDAS: DataFrame | Replace and others questions moduki1 2 1,758 Jan-10-2022, 07:19 PM
Last Post: moduki1
  PANDAS: DataFrame | Saving the wrong value moduki1 0 1,525 Jan-10-2022, 04:42 PM
Last Post: moduki1
  update values in one dataframe based on another dataframe - Pandas iliasb 2 9,099 Aug-14-2021, 12:38 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020