LIMIT
limits the number of rows returned in SQL. In pandas, the same is achieved by applying the .head()
method, or using .iloc[:x]
Selecting the first n rows in pandas
In SQL:
SELECT
*
FROM
table
LIMIT 10;
In pandas:
table.head(10)
Alternatively:
table.iloc[:10]
.iloc[:10]
returns the first 10 rows. Remember: Python is 0 indexed, so 10 rows with index 0-9 are returned. Row 10 is not included.