Created
January 30, 2025 14:58
-
-
Save devsjc/c53475c71aaae59ed9cb6e9b4f16ab40 to your computer and use it in GitHub Desktop.
Example of safer and more functional usage of the Pandas API
This file contains hidden or 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
| import pandas as py | |
| df = ( | |
| pd | |
| .read_csv("some-data.csv") | |
| .rename(columns={"value":"x"}) | |
| .assign(new_col=lambda df: df["x"] * 2) | |
| .loc[lambda df: df["y"] > 0.5] | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment