I have a dataset of which I have attached an image.
The set of unique values in Origin and Dest are same. Upon doing label encoding of those columns, I thought that value ATL will get same encoding in 'Origin' and 'Dest' but it turns out that the given code:
label_encoder = LabelEncoder()
flight_f['UniqueCarrier'] = label_encoder.fit_transform(flight_f['UniqueCarrier'])
flight_f['Origin'] = label_encoder.fit_transform(flight_f['Origin'])
flight_f['Dest'] = label_encoder.fit_transform(flight_f['Dest'])
Gives different encoding to a particular value in the two columns. And this is just the training set. I think in test set, I might get different values too which will hamper the predicitive analysis.
Can anyone suggest a solution, please?