Last answered:

01 Nov 2022

Posted on:

10 Oct 2022

0

I cannot load the data due to pickle error

UnpicklingError                           Traceback (most recent call last)
Input In [3], in <cell line: 1>()
----> 1 model = absenteeism_model('model', 'scaler')

File ~\Documents\Integration\absenteeism_module.py:42, in absenteeism_model.__init__(self, model_file, scaler_file)
     39 def __init__(self, model_file, scaler_file):
     40     # read the 'model' and 'scaler' files which were saved
     41     with open('model','rb') as model_file, open('scaler', 'rb') as scaler_file:
---> 42         self.reg = pickle.load(model_file)
     43         self.scaler = pickle.load(scaler_file)
     44         self.data = None

UnpicklingError: invalid load key, '{'.

How do I go about fixing this issue otherwise I cannot complete this module. Thank you in advance

1 answers ( 0 marked as helpful)
Instructor
Posted on:

01 Nov 2022

0

Hi Emmanuel!
Thanks for reaching out.

You should use your own versions of model and scaler files. Please, read the discussion in the following thread. Thank you.
https://365datascience.com/q/b09723d5e6

Hope this helps.
Best,
Tsvetelin

Submit an answer