I have a dataframe df
that looks like the following:
Type Size
Biomass 12
Coal 15
Nuclear 23
And I have a string str
such as the following: Biomass_wood
I would like to return the following dataframe:
Type Size
Biomass 12
This is because Biomass
is partially matched by the first part of Biomass_wood
.
This would effectively be the opposite of df[df.Type.str.contains(str)]
as the bigger string is contained in str
and not in the column Type