Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3
Something like this might work, depending on your index: counter = 0 for i in range(len(df)): if df.loc[i, "Elapsed"] == "On Time": counter += 1 df.loc[i, "On Time Count"] = counter
24th Nov 2022, 7:10 PM
Tibor Santa
Tibor Santa - avatar
+ 6
Goathland1111 , can you please make a sample how the dataframe looks now, and what you expect to get with the new column. thanks.
24th Nov 2022, 6:25 PM
Lothar
Lothar - avatar