Created
February 20, 2021 08:01
-
-
Save AyishaR/75d9511272d2b57c7332704fc48f8f44 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
colours = ['Blu', 'Whit', 'Yellow', 'Orang', 'Red'] # using root word of colours as the spelling can differ while specifying shades | |
df[colours] = 0 | |
for c in colours: | |
df.loc[df['Star color'].str.contains(c, case = False), c]=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment