Memory efficient encoding logic for group categories
There is several techniques that could work for you:


Target Encoder: Works well when there is a high cardinality of a categorical feature.
Ordinal/Label Encoding: Tradition label encoding
Weight Of Evidence:  tells the predictive power of an independent variable in relation to the dependent variable