logo-MindMajix
PostPythonPython
s
sri kanth

Posted on 22nd June 2024|11 views

0
votes

Pandas Get Index Of Row

How to get the index of rows which columns matches a certain value in python?

I have given a data frame with a column name "my_col" I just wanted to find the indexes of that data frame in which the values oh "my_col" = True within the range (50, 1000), anyone suggest me the proper way to write a code for this.

 

1 answers
Answers
P
veerubhotla sowmithri

Posted on 22nd June 2024| views

for j in range(50,1000): 

   if df.jloc[j]['my_Col']== True: 

      print j,df.jloc[j]['my_Col']

This may work 

 

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number