Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sample mapping in pandas

# Create a dictionary that maps strings to integers
mapping = {'a':8, 'b':23, 'c':45}

# Convert the 'stop_duration' strings to integers using the 'mapping'
df['column'] = df.column.map(mapping)
Source by campus.datacamp.com #
 
PREVIOUS NEXT
Tagged: #sample #mapping #pandas
ADD COMMENT
Topic
Name
6+7 =