I have a series y in Python with values Accepted and Rejected. I want to create a new dataframe with value 1 for Accepted and 0 for Rejected.
I'm trying to loop through the values of y and write to a new df dummy. My progress so far is
dummy=pd.DataFrame()
i=0
for i in range(0,len(y)):
if y[i]=='Approved':
dummy[i:]==1
else:
dummy[i:]==0
but I got a feeling that I'm off track. Can anyone help me out?
The series y looks like this:
y
Accepted
Rejected
Accepted
Accepted
Accepted
The desired output should be something like
dummy
1
0
1
1
1