How to encode high cardinality categorical data?
You may want to look into Target Encoding as an example:
https://contrib.scikit-learn.org/category_encoders/targetencoder.html
Another post from the forums:
Problem with converting string to dummy variables