Irshad_K
Irshad_K

Reputation: 13

Pandas Dataframe not showing all output columns in Eclipse IDE using PyDev Plugin

When I print a Pandas dataframe within the Eclipse IDE(with the PyDev plugin), not all of the columns are shown with the console, even though all of the columns are within the object as I can save to an CSV.

Here's a sample of what was entered into the dataframe variable:

   month  avg_high  avg_low  record_high  record_low  avg_precipitation
0    Jan        58       42           74          22               2.95
1    Feb        61       45           78          26               3.02
2    Mar        65       48           84          25               2.34
3    Apr        67       50           92          28               1.02
4    May        71       53           98          35               0.48
5    Jun        75       56          107          41               0.11
6    Jul        77       58          105          44               0.00
7    Aug        77       59          102          43               0.03
8    Sep        77       57          103          40               0.17
9    Oct        73       54           96          34               0.81
10   Nov        64       48           84          30               1.70
11   Dec        58       42           73          21               2.56

For the data entered in the dataframe, when I print the dataframe, the Console shows it like this(we can see that the avg_low & record_high columns show up as ...)

   month  avg_high        ...          record_low  avg_precipitation
0    Jan        58        ...                  22               2.95
1    Feb        61        ...                  26               3.02
2    Mar        65        ...                  25               2.34
3    Apr        67        ...                  28               1.02
4    May        71        ...                  35               0.48
5    Jun        75        ...                  41               0.11
6    Jul        77        ...                  44               0.00
7    Aug        77        ...                  43               0.03
8    Sep        77        ...                  40               0.17
9    Oct        73        ...                  34               0.81
10   Nov        64        ...                  30               1.70
11   Dec        58        ...                  21               2.56

[12 rows x 6 columns]

Any help would be appreciated in figuring this out!

Upvotes: 1

Views: 1620

Answers (2)

Mark
Mark

Reputation: 1

I have had a similar issue where I was able to print out the Dataframe OK in the "Command Prompt\Terminal shell" in Python but not within Eclipse IDE using PyDev and Pandas.

The work around I found was to wrap it in the print function Print().

So to see df.head() in Eclipse i am using Print(df.head()) for example. I hope this helps someone out there. KR, M.

Upvotes: 0

Plasma
Plasma

Reputation: 1961

It's just pandas truncating your output to make it fit on the screen. To print all the columns, set the proper pandas option:

import pandas as pd
pd.set_option("display.max_columns", 100)

Upvotes: 1

Related Questions