Python Forum
UnpicklingError: NEWOBJ expected an arg tuple.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UnpicklingError: NEWOBJ expected an arg tuple.
#1
Sad 
I'm new with this pickle and have to continue previous' code.

The code is about clustering data, and when I run, the error occurs:

UnpicklingError: NEWOBJ expected an arg tuple.

the code is like this

Quote:os.environ['ARROW_PRE_0_15_IPC_FORMAT']='1'
#clustering
group_key = pdf[group_col].iloc[0]
num_instances = pdf.shape[0]
mat = pdf[['recension_in_days','monetary','frequency']].values
print(bytes(pipeline_trf[group_key],'latin1'))
ss = pickle.loads(bytes(pipeline_trf[group_key],'latin1'))
# Using sklearn
mat = ss.transform(mat)
pdf = pdf.drop(columns=['model_id'])
pdf['cluster'] = result.T.tolist()

idk how to solve this because i cannot found similar problem. the bytes(pipeline_trf[group_key],'latin1') is like this
b'\x80\x03csklearn.preprocessing._data\nStandardScaler\nq)\x81q\x01}q\x02(X\twith_meanq\x03\x88X\x08with_stdq\x04\x88X\x04copyq\x05\x88X\x0en_features_in_q\x06K\x03X\x0fn_samples_seen_q\x07cnumpy.core.multiarray\nscalar\nq\x08cnumpy\ndtype\nq\tX\x02i8q\n\x89\x88\x87q\x0bRq\x0c(K\x03X\x01<q\rNNNJ\xff\xff\xff\xffJ\xff\xff\xff\xffKtq\x0ebC\x08t\x04q\x0f\x86q\x10Rq\x11X\x05mean_q\x12cnumpy.core.multiarray\n_reconstruct\nq\x13cnumpy\nndarray\nq\x14K\x85q\x15C\x01bq\x16\x87q\x17Rq\x18(K\x01K\x03\x85q\x19h\tX\x02f8q\x1a\x89\x88\x87q\x1bRq\x1c(K\x03h\rNNNJ\xff\xff\xff\xffJ\xff\xff\xff\xffKtq\x1db\x89C\x18\x05\xc2H;V\xa0\'@\x82\xfb\x08\xee\x8b\x1a\x10A\xac@\x18i\xc7\n\xf0?q\x1etq\x1fbX\x04var_q h\x13h\x14K\x85q!h\x16\x87q"Rq#(K\x01K\x03\x85q$h\x1c\x89C\x18\x9ap\xe9E\x8a.@.\x1e\x91S\xa6{\xfaA\x10\xdc2?L\x80e?q%tq&bX\x06scale_q\'h\x13h\x14K\x85q(h\x16\x87q)Rq*(K\x01K\x03\x85q+h\x1c\x89C\x18\xa19d\x18&\xfc\x0e@5\x85\x17\x16\xac\x95\xf4@x\xe2\x8d\xac\xff:\xaa?q,tq-bX\x10_sklearn_versionq.X\x051.0.1q/ub.'
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  code with no tuple gets : IndexError: tuple index out of range Aggam 4 2,847 Nov-04-2020, 11:26 AM
Last Post: Aggam
  How to get first line of a tuple and the third item in its tuple. Need Help, Anybody? SukhmeetSingh 5 3,218 May-21-2019, 11:39 AM
Last Post: avorane

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020