-2

Using:

import pandas as pd
x = pd.read_excel(r"C:\Users\nan\PycharmProjects\giraffe\GENERA.xlsx", engine="openpyxl")
print(x)

I can easily print the entire sheet from Excel into pycharm, but I needed only the first 5 lines of the Excel document. How can I do that?

enzo
  • 9,861
  • 3
  • 15
  • 38
rem
  • 1

1 Answers1

0

May be you want to use pandas.DataFrame.head()

x.head(5)
msanzal
  • 119
  • 6