How to generate dummies data with Pandas in Python?
• 1 minHow to generate dummies data with Python.
The answer is quite simple.
If you want 0 and 1 and don't care about their distributions you can use the pandas.get_dummies() method.
# We generate a dataframe with dummies data
df = pd.get_dummies(["col1","col2","col3"])
If you CARE about their respective distribution, then you should check the following post where I will talk about Data Generative Processes using random distribution.
Here you are! You now know how to generate dummies data with Pandas in Python.
More on DataFrames
If you want to know more about DataFrame and Pandas. Check out the other articles I wrote on the topic, just here :