Selecting the Number of Rows to Import from Excel Sheet with Pandas
Python
To select how many rows to import from an Excel sheet into a Pandas dataframe then pass the number using the "nrows" parameter. Note that Pandas will import whichever rows in encounters first.
For the example below, we are reading the first 500 rows from the Returns Excel sheet.
1| import pandas as pd 2| 3| df = pd.read_excel('Returns.xlsx', sheet_name='Returns', nrows=500)
149
132
127
119