Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
head()
#1
the command 'head()' only partially displays the excel file I am dealing with.
How do I display the whole file?

these lines
data=pd.read_excel(r'excelfile.xlsx')
print(data.head())
only print 5 rows and 5 columns (default value) and If I add a parameter to 'head()'
The rows and columns shown will be different but still no more than 5.

How do I show the excel file in its entirety ?
Reply
#2
add:
pd.set_option('display.max_columns', X) where X is number of columns,
pd.set_option("display.max_rows", Y) where Y = number of rows

use df.info() to get sizes

I'm not a pandas expert, so there may very well be a better way, but this will do the job.
Reply
#3
What’s wrong with print(data)?
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#4
Larz60:
that code only prints the amount of non-null values.
@perfringo:
your option has the same problem as "head()",
it only shows the first 5 and the last 5 rows
together with the first 2 and the last 3 rows.

I need to see the same info as an excel file in full
Reply
#5
look at https://stackoverflow.com/q/19124601/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  pandas head() not reading all rows naab 0 353 Apr-07-2020, 01:06 PM
Last Post: naab

Forum Jump:

User Panel Messages

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