I have some DataFrame df1
without index like this:
[
"event_id", "cat_id", "clm_1", ..., "clm_n"
123, 345, "qwe", ..., "asd"
999, 222, "sss", ..., "ddd"
...
333, 345, "qqq", ..., "ooo"
]
And another DataFrame df2
(cat_id
is index):
[
"cat_id", "features"
345, "cat,dog"
567, "chupacabra"
...
]
cat_id
in df1
is non-unique, but it is unique in df2
and it is an index
How can I add new features
column to df1
and populate it from df2
by cat_id
?
Expected result is:
[
"event_id", "cat_id", "clm_1", ..., "clm_n", "features"
123, 345, "qwe", ..., "asd", "cat,dog"
999, 222, "sss", ..., "ddd", None
...
333, 345, "qqq", ..., "ooo", "cat,dog"
]