Slice rows from pandas DataFrame

Extract the rows with index 5 to 10 (inclusive) from the companies DataFrame and assign them to a variable called rows. Use DataFrame.loc[] to slice the rows.
import pandas as pd df = pd.read_csv('/data/companies.csv') # get rows from index 5 to 10 (inclusive)
rows =
print(len(rows)) # expected output: 6
Python
Setting up Python environment...
Output