The last time I used Python is some time ago so some things have faded away.
I have a given dataset, with multiple columns. I want to create a new column and set the values based on multiple values (text or value) of other columns.
So in the example below, c1 consists of [a,a,b,b] and c2 of [a,b,a,b]. Now I want the new column c3 to be [1,2,3,4]
All help is appreciated!
import pandas as pd
data = pd.read_excel('data')
data['c3'] = 0
for i in range(len(data.c3)):
if data.c1[i] == a and data.c2[i] == a:
data.c3[i] == 1
elif data.c1[i] == a and data.c2[i] != a:
data.c3[i] == 2
elif data.c1[i] != a and data.c2[i] == a:
data.c3[i] == 3
elif data.c1[i] != a and data.c2[i] != a:
data.c3[i] == 4```