I am very new to Python coding, so I am trying to understand some basics - any input is appreciated.
I have a list of weekly dates, and I'm trying to run the if statement on days, i.e. if the number of days is less than 7, create a column with coefficient x or create coefficient y - as shown in the table below:
week day check factor
0 2017-01-08 8 False x
1 2017-01-15 15 False x
2 2017-01-22 22 False x
3 2017-01-29 29 False x
4 2017-02-05 5 True y
I tried the code below:
if df['day'] <7 :
factor=weeks['day']/7
else:
....
and received an error message:
ValueError: The truth value of a Series is ambiguous
, , , , true/false. /, , . ?