Write an sklearn pipeline that takes in input a dataframe , apply simple imputer with…
- User
Write an sklearn pipeline that takes in input a dataframe , apply simple imputer with constant values, fit a regression and fill missing in a variable using that regression
- Assistant
- User
how to export a dictionary containing 2 linear regression models and one dictionary
- Assistant
- User
2025-02-03 18:43:11,949 - ERROR - Error during execution: MissingValuesImputers.fit_fatturato_regression() got multiple values for argument 'data'
mod_fatturato = self.fit_fatturato_regression(data=input_data)
def fit_fatturato_regression(data): data.fillna({'A':90}, inplace = True) data.dropna(susbet='B', inplace = True) model = LinearRegression(fit_intercept = True) model.fit(X=data[['A']],y=[['B']]) return model
- Assistant
The error message you received indicates that there was an issue with how the
fit_fatturato_regressionfunction was called. Specifically, it suggests that there were "multiple values for the argument 'data'," which typically results from a mismatch between positional and keyword parameters in the function call. - User
i am inside a class
mod_fatturato = self.fit_fatturato_regression(df=input_data)
def fit_fatturato_regression(df): df.fillna({'SFIN':50}, inplace = True) df.dropna(subset='FATTURATO', inplace = True) model = LinearRegression(fit_intercept = True) model.fit(X=df[['SFIN']],y=df['FATTURATO']) return model
- Assistant
It looks like you are defining a method
fit_fatturato_regressioninside a class and trying to call it using the keyword. However, the function definition itself is missing the parameter, which is required for instance methods in Python classes. - User
open pikle in python
- Assistant