Skip to content
Advertisement

Can’t get substring from strings. Help needed

I have a column that contains string like

JavaScript

Expected Output:

JavaScript

What I need is to get the substring (GDNDL380F4) after Name= to column Name and substring (FTT-87) after Type= to column Type.

I tried different approaches with str.extract, find and re.find but for some reason I get wrong result (nan or an empty array). So help is needed.

Advertisement

Answer

Make a dictionary from the string and get the items by key

JavaScript

Pandas solution:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement