Java: removing numeric values from string
This will remove all digits: firstname1 = firstname1.replaceAll(“\\d”,””);
This will remove all digits: firstname1 = firstname1.replaceAll(“\\d”,””);
var arr = [“I”, “am”, “”, “still”, “here”, “”, “man”] // arr = [“I”, “am”, “”, “still”, “here”, “”, “man”] arr = arr.filter(Boolean) // arr = [“I”, “am”, “still”, “here”, “man”] filter documentation // arr = [“I”, “am”, “”, “still”, “here”, “”, “man”] arr = arr.filter(v=>v!=”); // arr = [“I”, “am”, “still”, “here”, “man”] Arrow … Read more
df[‘name’].str.replace(r”\(.*\)”,””) You can’t run re functions directly on pandas objects. You have to loop them for each element inside the object. So Series.str.replace((r”\(.*\)”, “”) is just syntactic sugar for Series.apply(lambda x: re.sub(r”\(.*\)”, “”, x)).