I'm really stuck. I have a dataframe with a column that goes like the following
Dailychange:
1
2
3
0
-1
-2
-3
1
2
I want to calculate number of positive and negative consecutively into two lists with the output pos[3,2] nutral[1] neg[3]. I have tried resolving it with a simple loop like
# for i in symbol:
# if (symbol['Dailychange']>0):
# counter+=1
# cons_list.append(counter)
# else:
# counter=0
# cons_list.append(counter)
# print(cons_list)
and this outputs an error, due to my if statement. Then I tried to use the where function
symbol['positive']=symbol.where(symbol['Dailychange']>0,'positive','Negative')
That didn't work out either. I really appreciate your help on this.