Consider the following dataframe:
import pandas as pd
from sklearn.preprocessing import LabelEncoder
df = pd.DataFrame(data=[["France", "Italy", "Belgium"], ["Italy", "France", "Belgium"]], columns=["a", "b", "c"])
df = df.apply(LabelEncoder().fit_transform)
print(df)
It currently outputs:
a b c
0 0 1 0
1 1 0 0
My goal is to make it output something like this by passing in the columns I want to share categorial values:
a b c
0 0 1 2
1 1 0 2