Python Forum
head() - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: head() (/thread-29452.html)



head() - d8a988 - Sep-02-2020

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 ?


RE: head() - Larz60+ - Sep-03-2020

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.


RE: head() - perfringo - Sep-03-2020

What’s wrong with print(data)?


RE: head() - d8a988 - Sep-03-2020

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


RE: head() - buran - Sep-03-2020

look at https://stackoverflow.com/q/19124601/4046632