One can use python re functions to do so.
Below is an example where one replaces any occurrence of 'genus.*'
with 'Genus'
.
It will match and replace for example 'genUS'
, 'GENUS'
, 'Genus_666'
import pandas as pd
import re
df = pd.read_csv('Crokis.csv', index_col=0, encoding = "ISO-8859-1", low_memory=False)
# 'Genus' column renaming
f = lambda x: re.sub('genus.*','Genus', x, flags = re.IGNORECASE)
df.rename(columns = f, inplace = True)