Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Map values in Pandas column using dictionary

Subjects = {"Sheldon" : "Science",
            "Raj" : "Chemistry",
            "Leonard" : "Maths",
            "Howard" : "Astronaut",
            "Amy" : "Science"}
                     
df["Subjects"] = df["first_name"].map(Subjects)
Source by www.projectpro.io #
 
PREVIOUS NEXT
Tagged: #Map #values #Pandas #column #dictionary
ADD COMMENT
Topic
Name
6+1 =