DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
pandas map multiple columns
col_map
=
pd
.
Series
(
df
.
col1
.
values
,
index
=
df
.
col2
)
.
to_dict
(
)
df
[
'col1'
]
=
df
[
'col2'
]
.
map
(
col_map
)
PREVIOUS
NEXT
Tagged:
#pandas
#map
#multiple
#columns
ADD COMMENT
Topic
COMMENT
Name
3+2 =
Submit