I have a pandas dataframe with a "gender" column in which every value is "m" or "f".
I want to make a seaborn barplot where the labels are "Male" and "Female".
I could do this ...
df['gender'] = df['gender'].replace({"m":"Male", "f":"Female"})
sns.barplot(data=df, x="something", y="value", hue="gender")
... but that's not ideal if I only want to change the "gender" column temporarily just for plotting.
Is there a way to change the values in one column inline?
... something like this:
sns.barplot(
data=df.replace({"m":"Male", "f":"Female"}, col="gender"),
x="something",
y="value",
hue="gender")