Created
October 6, 2022 15:21
-
-
Save h3ik0th/a273aecf3d5672b47d31e2eac7acb474 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%time | |
# apply, but pre-select columns e and f instead of complete rows: iteration misdemeanor | |
def myfunc4(b, c): | |
x = (b + c)**2 | |
y = (b - c)**2 | |
z = (b - c)**2 | |
return x, y,z | |
dfY = pd.DataFrame() | |
dfY[["x", "y", "z"]] = dfS.apply(lambda x: myfunc4(x["B"], x["C"]), axis=1, result_type="expand") | |
display(dfY.tail()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment