Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Extract the string in one column when matches with another string list to make a new column (Updated) [duplicate]

$
0
0

I have a dataframe:

A_1
AB546 GTY 3
BYU345 456 2
AB546 HYT 1
BYU345 BWER 34

And, a search list of [546, 345]. If the string has any number of search list, then the whole string is extracted.

I would like to make a new column of the alphanumeric string without the other part of string like this

A_1A_2
AB546 GTYAB546
BYU345 456BYU345
AB546 HYTAB546
BYU345 BWERBYU345

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>