Iloc

Sat 17 May 2025

title: "iLoc Simple" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


import pandas as pd
df = pd.read_csv('data1.csv', sep=',', header=None)
df
0 1 2
0 capacity score length
1 1 10 30
2 2 20 30
3 3 30 40
4 3 40 30
5 2 30 40
6 7 10 23
7 3 20 22
8 8 20 11
9 2 30 2
print(df.iloc[:4]) # 0 - 4 = 5 values
          0      1       2
0  capacity  score  length
1         1     10      30
2         2     20      30
3         3     30      40

Score: 5

Category: data-wrangling