Open LalehT opened 6 years ago
@LalehT max(df['Gold']-df['Gold.1']) gives the maximum difference between the value of df['Gold'] and df['Gold.1'] which is 3850(4809-959) ,this implies x=3850 . your code: '''df[max(df['Gold']-df['Gold.1'])]''' is equivalent to '''df[3850]''' which will give the key error.
Hi, could you please explain what does this piece of code do? why should we use Boolean masking? x = max(df['Gold'] - df['Gold.1']) ans = df[(df['Gold'] - df['Gold.1']) == x].index.tolist()
and why doesn't something like this work? ans = df[max(df['Gold']-df['Gold.1'])].index.tolist()
and what does this do? .index.tolist()
Thanks in advance.