I am using OneHotEncoder to encode few categorical variables (eg - Sex and AgeGroup). The resulting feature names from the encoder are like - \'x0_female\', \'x0_male\', \'x1_0.
column_name = encoder.get_feature_names(['Sex', 'AgeGroup']) one_hot_encoded_frame = pd.DataFrame(train_X_encoded, columns= column_name)