To select the last row using the .loc accessor in pandas, you can use the [-1:] indexing notation. Here's an example:
main.py170 chars10 lines
This will output:
main.py16 chars3 lines
Note that we use [-1:] instead of [-1] to get a DataFrame with a single row. If we used [-1], it would return a series instead.
gistlibby LogSnag