Skip to content

Instantly share code, notes, and snippets.

@justinhchae
Last active January 1, 2021 02:15
Show Gist options
  • Save justinhchae/0e79c9ef92fe07fa187003ae0277a2e0 to your computer and use it in GitHub Desktop.
Save justinhchae/0e79c9ef92fe07fa187003ae0277a2e0 to your computer and use it in GitHub Desktop.
Another example of a lambdas that changes all values
# replace all values with the same thing
df[col1] = df[col1].apply(lambda x: x.replace(year=2109, month=1, day=1))
print(df[col1].head(2))
# output
"""
event_date
2109-01-01
2109-01-01
...
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment