Initially, I have a dataset where for each row there is **user\_id** and **product\_ids** he bought.

In that dataset there are 478191 products bought by different users. 

In order to discover frequent items that are bought together, I will use association rules, apriori algorithm.
As [apriori algorithm](http://rasbt.github.io/mlxtend/user_guide/frequent_patterns/association_rules/) expects to have the features **one-hot encoded**. I need the product\_ids one-hot encoded.

Scikit-learn one-Hot encoding (sparse matrix=True) resulted in memory error. What other methods can I try? (using Python)