so I have a hypothetical dataframe:
data = {'sample': [0, 0, 1, 0 , 1, 1],
"y": [4, 8 , 3, 2, 3, 9],
"x": [3 , 5, 6, 2, 3, 6]}
df = pd.DataFrame(data, columns = ["sample", "y", "x"])
And I want to iterate over each row, and obtaining the values of X and Y if sample equals 1.
I tried the following but I am clearly doing something wrong:
for index, row in df.iterrows():
ydf = df["y"]
y.append()
I tried some solutions that I found on the internet but I just don't get it at the moment, even though it is a really simple solution (probably).