Last active
October 2, 2020 08:43
-
-
Save MarkusMueller-DS/f9748e61b0143d4221eca900c3616a71 to your computer and use it in GitHub Desktop.
Create a new column with a lambda function
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
# code creates a new column based on the quality of the wine using 6 as a threshold | |
df['rating'] = df['quality'].apply(lambda x: 'good' if x >= 6 else 'bad') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment