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

patsy equivalent of R's all.vars #155

Open
Xiaojieqiu opened this issue May 18, 2020 · 1 comment
Open

patsy equivalent of R's all.vars #155

Xiaojieqiu opened this issue May 18, 2020 · 1 comment

Comments

@Xiaojieqiu
Copy link

Hey patsy developers, I wonder how can we retrieve the variable names from the model formula string (in R, this can be done via the all.vars function). For example,

if I have ("y ~ x1:x2 + np.log(x3) + I(x4^2)"), I want to return a list of ['x1', 'x2', 'x3', 'x4'].
Similarly, if I have ("~cr(time, df = 3)"), I want to return a list of ['time'].

Your help is highly appreciated!

@compumetrika
Copy link

I noticed your issue when I was writing up my own. I posted a solution to a different but related problem here; you may be able to use this to solve your problem: #171

It isn't an implementation of all.vars but may none the less still be useful.
Good luck!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants