Sometimes, count or frequency can be useful features for your model. If you want to replace categories by the frequency of observations per category, use feature_engine’s CountFrequencyEncoder.
CountFrequencyEncoder
In the code above I encode color and clarity.
color
clarity
Link to feature-engine.