Pandas replace rare values in a pipeline
You could use scikit-learn's TransformerMixin which provides an implementation of fit_transform for you (its implementation is available here for interest).

I'd consider renaming RemoveScarceValuesFeatureEngineer to something that fits a bit more with other classes in scikit-learn. How about RareValueTransformer instead?

What do you want to happen if an unseen value is transformed? Take, for example


sample_test = pd.DataFrame([{&quot;a&quot;: 1, &quot;s&quot;: &quot;a&quot;}, {&quot;a&quot;: 2, &quot;s&quot;: &quot;b&quot;}])
print(sample_test)
print(rssfe.transform(sample_test))

This raises a KeyError, which isn't what I expected. I'd either rework your code to ignore unseen values, or return a nicer error if this is what you want to happen. To me, ignoring seems more reasonable, but it's up to you! Making some unit tests would give you more confidence in cases like this, too.
A pedantic aside: you have a typo of 'occurrence' in min_occurences, which is easily amended.