I have dataframe i want remove star and all the empty line in localisation. I have to create two columns "temp" and "word".
"temp" contains all the lines after the first line break and the column "word" represents all the words of this list found in "temp":
words = ['SECTION 11', 'CONE', 'BELLY', 'FIXED PLAN']
My input:
Ouput expected: I have to replace star with empty in the "word" column:
I try this
def SplitRow(description):
import re
substring=re.findall(r"[A-Za-z0-9,\*\s]+",description.split("\n")[1])
if description.split("\n")[1] in substring:
if re.findall(r"^\s?\*\$", description.split("\n")[1]):
return "etoile"+description.split("\n")[1]
if re.findall(r"Localisation\s*:.*", description.split("\n")[1]):
return description.split("\n")[2]
return description.split("\n")[1]
but it doesn't work as there are a lot of rows with None:


