title: How do I go line by line in my dataframe?
body: <p>I am looking to be able to loop through line by line of my dataframe, checking certain criteria, (if a staff member is available at a certain time etc.) and adding them to a list if they are available. To do this I plan on looping through each row of my dataframe until it's gone through them all. Having some trouble currently, any help is appreciated. In the example, I just want it to simply count the rows, just so I know the looping through actually works. <a href="https://lhamu.medium.com/building-a-custom-staff-scheduling-model-a-beginners-journey-using-simple-python-c568c9965940" rel="nofollow noreferrer">This</a> is what I am trying to replicate in the end. If anyone has knows how they can help achieve the end goal I will appreciate that greatly.</p>
  <p>ps. I am not too experienced so sorry if this is a silly question, don't be too harsh.</p>
  <pre><code>def staffEarlyShift(staff):
      x = 1
      staff_shift = []
      for i in range(len(staff)):
          print (x)
          x = x + 1
  
  staffEarlyShift(staff_df)
  
  
  
  
  </code></pre>
  <p><strong>dataframe</strong></p>
  <pre><code>    staffID                   days_can_work time_can_work     role
  0         1  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  1         2  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  2         3  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  3         4  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  4         5  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  5         6  [mon,tue,wed,thur,fri,sat,sun]         (9,7)     chef
  6         7  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  7         8  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  8         9  [mon,tue,wed,thur,fri,sat,sun]         (9,7)     chef
  9        10  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  10       11  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  11       12  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  12       13  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  13       14  [mon,tue,wed,thur,fri,sat,sun]         (9,7)     chef
  14       15  [mon,tue,wed,thur,fri,sat,sun]         (9,7)     chef
  15       16  [mon,tue,wed,thur,fri,sat,sun]         (9,7)     chef
  16       17  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  17       18  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  18       19  [mon,tue,wed,thur,fri,sat,sun]         (9,7)  waitron
  </code></pre>