def divide_data(x_data,fkey,fval):
x_right = pd.DataFrame([],columns=x_data.columns)
x_left = pd.DataFrame([],columns=x_data.columns)
for ix in range(x_data.shape[0]):
val = x_data[fkey].loc[ix] # fkey => feature
if val > fval:
x_right = x_right.append(x_data.loc[ix])
else:
x_left = x_left.append(x_data.loc[ix])
return x_left,x_right
in line 5, why cant we write x_data[ix][fkey] ? is there any other way of representation?