Last N Rows
import numpy as np
import pandas as pd
df = pd.read_csv('data1.csv')
df
capacity | score | length | |
---|---|---|---|
0 | 1 | 10 | 30 |
1 | 2 | 20 | 30 |
2 | 3 | 30 | 40 |
3 | 3 | 40 | 30 |
4 | 2 | 30 | 40 |
5 | 7 | 10 | 23 |
6 | 3 | 20 | 22 |
7 | 8 | 20 | 11 |
8 | 2 | 30 | 2 |
df_last = df[-4:]
df_last
capacity | score | length | |
---|---|---|---|
5 | 7 | 10 | 23 |
6 | 3 | 20 | 22 |
7 | 8 | 20 | 11 |
8 | 2 | 30 | 2 |