I don't see what's wrong with the status quo:
smf.ols(formula='Lottery ~ Literacy + Wealth + Region', data=df)
If I understand correctly you want to use instead:
smf.ols(formula=df.Lottery ~ df.Literacy + df.Wealth + df.Region)
Or since some people favor indexing over attribute access for column names:
smf.ols(formula=df['Lottery'] ~ df['Literacy'] + df['Wealth'] + df['Region'])
Both alternatives are much more verbose since you have to repeat the `df` part or even worse the brackets for indexing. In any case you need to type the column names that you would like to include and there's no auto-complete on column names that would help you typing it. So I don't see what's the benefit of the operator version.
In addition this requires Pandas to implement the modeling but there's much more to Pandas than just modeling so perhaps that better remains a separate project.
On 24.02.20 01:27, Aaron Hall via Python-ideas wrote:
I have no behavior for integers in mind. I would expect high-level libraries to want to implement behavior for it.
- pandas, numpy, sklearn, statsmodels
- other mathematically minded libraries (monadic bind or compose?)
To do this we need a name. I like `__sim__`. Then we'll need `__rsim__` and `__isim__` for completeness. We need to make room for it in the grammar. Is it ok to give it the same priority of evaluation as `+` or `-`, or slightly higher?
In the past we've made additions to the language when we've been parsing and evaluating strings. That's what we're currently doing in statsmodels right now because we lack the binary (in the sense of two-arguments) `~`.
See: https://www.statsmodels.org/dev/example_formulas.html _______________________________________________ Python-ideas mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/JWC4HJ... Code of Conduct: http://python.org/psf/codeofconduct/