0

While trying to convert the model object to pickle i am getting an error:

TypeError: 'DataFrame' object is not callable

I am using the below code:

import pickle
with open('model_lin1.pkl','wb') as modelpickle:
    pickle.dump(model_lin1,modelpickle)
Yogesh Govindan
  • 339
  • 2
  • 12
  • There is no fault in the code you posted. However, your example is not reproducible. We do not know what `model_lin1` is. I suspect it is not an instance of `pd.DataFrame`, since if it was your code should work. Furthermore, pandas has built-in support for pickling. Simply call `.to_pickle()` on your data frame. – MaxPowers Dec 02 '20 at 10:09
  • Check this: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_pickle.html – some_programmer Dec 02 '20 at 10:10
  • Does this answer your question? [How to store a dataframe using Pandas](https://stackoverflow.com/questions/17098654/how-to-store-a-dataframe-using-pandas) – some_programmer Dec 02 '20 at 10:10
  • model_lin1 is a linear regression model. – Yogesh Govindan Dec 02 '20 at 10:16

0 Answers0