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.
You can pass the list with original column names to get_feature_names:
get_feature_names
encoder.get_feature_names(['Sex', 'AgeGroup'])
will return:
['Sex_female', 'Sex_male', 'AgeGroup_0', 'AgeGroup_15', 'AgeGroup_30', 'AgeGroup_45', 'AgeGroup_60', 'AgeGroup_75']