Skip to content

Commit f847e27

Browse files
committed
fix asscalar is deprecitaed error on python3.8
1 parent 14ebe6c commit f847e27

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

jdata/jdata.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ def decode(d, opt={}):
185185
newobj=newobj.reshape(d['_ArraySize_'],order='F')
186186
else:
187187
newobj=newobj.reshape(d['_ArraySize_'])
188-
if(len(d['_ArraySize_']) == 1 and d['_ArraySize_'][0] == 1):
189-
newobj=np.asscalar(newobj);
188+
if(d['_ArraySize_'] == 1):
189+
newobj=newobj.item();
190190
return newobj;
191191
elif('_ArrayData_' in d):
192192
if(isinstance(d['_ArrayData_'],str)):
@@ -204,7 +204,7 @@ def decode(d, opt={}):
204204
else:
205205
newobj=newobj.reshape(d['_ArraySize_'])
206206
if(d['_ArraySize_'] == 1):
207-
newobj=np.asscalar(newobj);
207+
newobj=newobj.item();
208208
return newobj;
209209
else:
210210
raise Exception('JData', 'one and only one of _ArrayData_ or _ArrayZipData_ is required')

0 commit comments

Comments
 (0)