how to get last 100 observations with iloc pandas in python

To get the last 100 observations of a pandas dataframe using iloc, you can use the following code snippet:

main.py
df.iloc[-100:]
15 chars
2 lines

Here, df is the name of the dataframe and we're using iloc to slice the dataframe using [:-100:] to get the last 100 rows.

related categories

gistlibby LogSnag