Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (17.6k points)

I have a dataframe df :

   20060930  10.103       NaN     10.103   7.981

   20061231  15.915       NaN     15.915  12.686

   20070331   3.196       NaN      3.196   2.710

   20070630   7.907       NaN      7.907   6.459

Then I want to select rows with certain sequence numbers which indicated in a list, suppose here is [1,3], then left:

   20061231  15.915       NaN     15.915  12.686

   20070630   7.907       NaN      7.907   6.459

How or what function can do that ?

1 Answer

0 votes
by (41.4k points)

You can also use iloc:

df.iloc[[1,3],:]

If you want to learn more about Pandas then visit this Python Course designed by the industrial experts.

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...