I am trying to loop through an entire Python Pandas DataFrame , but it does not seem to be looping through the entire DataFrame. It works for DataFrames of shorter lengths but not this one. Also, I am working in Jupyter Notebook.
I have added some print statements to try and debug.
def dropNotIn(df):
print(df.shape)
removedlist = []
droplist = []
for i, x in df.iterrows():
rownum = i
print(rownum)
print(len(df))
Results for dropNotIn(df):
(59610, 9)
3449 --> Expected to be 59610
59610
Here is my df.head():
date attendance venue_city venue_state venue_name away_team home_team away_points home_points
9 2015-12-13 1740.0 Chicago IL McGrath-Phillips Arena Arkansas-Little Rock DePaul 66 44
13 2015-11-22 0.0 St. Thomas NaN Virgin Islands Sport & Fitness Center Tulsa Indiana State 67 59
14 2014-12-04 3469.0 St. Bonaventure NY Reilly Center Buffalo St. Bonaventure 63 72
21 2015-11-20 1522.0 St. Thomas NaN Virgin Islands Sport & Fitness Center Hofstra Florida State 82 77
24 2014-11-23 NaN St. Thomas NaN Virgin Islands Sport & Fitness Center Gardner-Webb Seton Hall 67 85