Skip to content

Instantly share code, notes, and snippets.

@ycui1
Created October 14, 2021 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ycui1/d33792bbf0b01b0df887086ba833be2e to your computer and use it in GitHub Desktop.
Save ycui1/d33792bbf0b01b0df887086ba833be2e to your computer and use it in GitHub Desktop.
>>> def taking_larger_square(s1, s2):
... return s1 * s1 if s1.sum() > s2.sum() else s2 * s2
>>> df0.combine(df1.rename(columns={"c": "a", "d": "b"}), taking_larger_square)
a b
0 4 25
1 9 36
2 16 49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment