Would anyone please tell me what is k here?
def rule(x, y):
if x == 'high' and y > 10:
return 1
else:
return 0
df = pd.DataFrame({ 'c1':[ 'high' ,'high', 'low', 'low'], 'c2': [0, 23, 17, 4]})
df['new'] = df.apply(lambda k: rule(k['c1'], k['c2']), axis = 1)
df.head()
and why can't I just use the following?
df['new'] = df["c1","c2"].apply(rule['c1'], ['c2'])