Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 475

How to select first N rows and last row in Python Pandas?

$
0
0

Problem: Select first N rows and last row in Python Pandas.

only gets 1 row which is index 9 and last row.

df.iloc[[(9),-1]]

I thought I could get using head and last row but not working.

df.iloc[[head(9),-1]]

Target output:0123up to9last row


Viewing all articles
Browse latest Browse all 475

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>