Skip to content
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

Implement equivalent of cut function from base R #415

Closed
wesm opened this issue Nov 25, 2011 · 1 comment
Closed

Implement equivalent of cut function from base R #415

wesm opened this issue Nov 25, 2011 · 1 comment
Milestone

Comments

@wesm
Copy link
Member

wesm commented Nov 25, 2011

No description provided.

@wesm
Copy link
Member Author

wesm commented Dec 6, 2011

@jseabold suggested a solution like this on the ML

# make some age variables 15-70
age = np.random.randint(15, 71, size=100)

# bin them into groups 15-24, 25-34, 35-70.
bin_idx = np.digitize(age, [25, 35, 71])

# make dummy variables
import scikits.statsmodels.api as sm
age_dummy, labels = sm.categorical(bin_idx, drop=True, dictnames=True)

@wesm wesm closed this as completed in c14c094 Jun 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant