I have a data frame which has two columns, "Title" and "Description". The title column has a bunch of titles related to clinical lab tests. Unfortunately, most of the titles are a repeat of the same test but, due to minor changes in the titles, titles are shown as unique.
values = [('Complete blood picture', 'AB'), ('Complete BLOOD test', 'AB'), ('blood glucose', 'AB'), ('COMplete blood Profile', 'AB')]
labels = ['title', 'description']
import pandas as pd
labtest = pd.DataFrame.from_records(values, columns = labels) # Create data frame
This is how the data frame looks like. [The actual dataset has many such titles, this is only for the purpose of this question]
Title Description
Complete blood test AB
COMPLETE Blood test\ AB
Blood glucose AB
Complete blood picture AB
And this is what I would the like the data frame to look like:
Title Description
Blood test AB
Blood test AB
Blood test AB
Blood test AB
I would like to search for the word "blood" in each title and if its true, then change the whole title with "Blood test". Is there a way to do this?