-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Easy function for making dummy variable matrices #955
Comments
Not sure what people would want but in the absence of a strong reason to do otherwise, I would prefer to not transpose the axes. |
I only transposed there to make it output to the console (lot of long-ish columns) |
got it. |
i mean, you see the example above, right? You have multiple columns and you want to produce dummy columns for each combination of a set of factors |
i think this machinery might already be in |
looks pretty covered by |
@jreback any opinion on reopening this so get_dummies can handle DataFrames?
We could replace this features = pd.concat([data.get(['Fare', 'Age']),
pd.get_dummies(data.Sex, prefix='Sex'),
pd.get_dummies(data.Pclass, prefix='Pclass'),
pd.get_dummies(data.Embarked, prefix='Embarked')],
axis=1) with this features = pd.get_dummies(data, include=['Sex', 'Pclass', 'Embarked'], exclude=['Fare', 'Age]) Or we can check they dtypes on the DataFrame to see that [ |
+1 |
@TomAugspurger nice idea. pls open a new issue for this though. |
Here is another technique to create automatically dummie: http://python-apuntes.blogspot.com.ar/2017/04/creacion-de-variables-de-grupo.html |
there are already a few things floating around but having something more structured / more options + in the pandas namespace would be nice
from an e-mail on the statsmodels mailing list
The text was updated successfully, but these errors were encountered: