Im using python, and i have some difficulties to loop over rows in python. my dataframe contains 3 columns : id, val1, size. i want to create column col1 based on size. Il trying this code and my code is never inside the first condition . How should i correct it please. Let's say that i don't won't something working with other method, im trying just to cirrect my own code.
Friendly,
Sample of data
data = [['x1', 100, 1], ['x2', 200, 2], ['x3', 300, 1]]
df = pd.DataFrame(data, columns = ['id', 'val1', 'size'])
code
if (df['size'] == 2) is True:
df['col1'] = df['val1']
print("1")
else:
pass