I've figured out how to iterate through a specific column within a csv file with n columns. But now I want to create a conditional and I'm not sure how.
The column in question is a column of days of the week (Monday, Tuesday, etc.). I want to write code so that my iteration counts all the Mondays, all the Tuesdays, so and so forth. This is what I wrote up and I get a syntax error.
mon = 0
# print (df)
days_week = df.iloc[4:,2]
# print(days_week)
for i in days_week:
if i == "MONDAY"
mon+=1
The data type for this particular column right now 'object'. So I figure I need to change it to strings?
ifis very like that offorloops -- you'll need a colon:at the end of theifstatement, and to indent the next line. But JALO's answer solves everything nicely.