pysal / spreg

Spatial econometric regression in Python
https://pysal.org/spreg/
Other
66 stars 23 forks source link

ENH: support pandas object as X, y #127

Closed martinfleis closed 3 weeks ago

martinfleis commented 10 months ago

Assuming that the data we work with are most likely pandas.DataFrames, I find this pattern a bit unintuitive.

spreg.OLS(
    df[["dependent"]].values,
    df[independent_names].values,
    name_y="dependent",
    name_x= independent_names,
)

Since the data already have names in the original data frame, I would love to see this pattern:

spreg.OLS(
    df["dependent"],
    df[independent_names],
)

where spreg gets values for name_y and name_x automatically as the name of the Series and column names.

This currently fails on the check_arrays call.

pedrovma commented 3 weeks ago

This feature will be in the next release.

pedrovma commented 3 weeks ago

Added in #145.