Python Forum

Full Version: head()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ?
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.
What’s wrong with print(data)?
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