Skip to content
Snippets Groups Projects
Commit ae8116bf authored by Blaise Li's avatar Blaise Li
Browse files

Escaping column name in query.

This caused bugs with libraries named "1_1", which was interpreted as
number 11.
parent ba80a31e
No related branches found
No related tags found
No related merge requests found
......@@ -1367,10 +1367,10 @@ def do_linear_regression(data, x_col, y_col, y_min=0, fit_intercept=True, transf
"""
if transform is not None:
data = getattr(np, transform)(
data[[x_col, y_col]].dropna().query(f"{y_col} >= {y_min}")).replace(
data[[x_col, y_col]].dropna().query(f"`{y_col}` >= {y_min}")).replace(
[np.inf, -np.inf], np.nan).dropna()
else:
data = data[[x_col, y_col]].dropna().query(f"{y_col} >= {y_min}")
data = data[[x_col, y_col]].dropna().query(f"`{y_col}` >= {y_min}")
lm = LinearRegression(fit_intercept=fit_intercept)
X = data.drop(y_col, axis=1)
lm.fit(X, data[y_col])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment