how to remove last 2 rows in a dataframe 1

how to remove last 2 rows in a dataframe

df1 = df.iloc[:3]

Here is what the above code is Doing:
1. We’re selecting the first 3 rows of the dataframe.
2. We’re selecting the first 3 columns of the dataframe.
3. We’re selecting the first 3 rows and the first 3 columns of the dataframe.

Similar Posts