-
Notifications
You must be signed in to change notification settings - Fork 104
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
DesignMatrix should have to_dataframe() method #30
Comments
In principal, I agree with the sentiment. I'm not sure I agree with the design you've proposed, but if you hand off a pandas object to patsy, I think it should be trivial to get one back at some point even if you don't specify |
I also think something like this might be useful for keeping track of pandas metadata for future use. |
Sorry for missing this. Seems reasonable to me. |
Currently, a
But I agree with @shoyer, it would be better if the |
This would be useful, for example, when I really want to be able to use a design matrix as both a raw numpy array and a pandas dataframe.
I suppose I could specify
return_type="dataframe"
and then get the numpy array from df.values, and it's also not hard to build the dataframe from scratch, but this would be particularly handy for interactive use, where it would provide a useful shortcut (e.g.,X.to_dataframe().plot()
orX.to_dataframe().head()
).To do this right, the new method would be factored out of build_design_matrices. Roughly speaking, it would look like this:
The main design change would be that DesignInfo (or DesignMatrix) would need to gain a
pandas_index
attribute, which would keep track of any index from the original data.If this seems reasonable, I could put together a pull request.
The text was updated successfully, but these errors were encountered: