@@ -404,7 +404,7 @@ def encode(obj):
404404 if isinstance (obj , RangeIndex ):
405405 return {
406406 "typ" : "range_index" ,
407- "klass" : obj . __class__ .__name__ ,
407+ "klass" : type ( obj ) .__name__ ,
408408 "name" : getattr (obj , "name" , None ),
409409 "start" : obj ._range .start ,
410410 "stop" : obj ._range .stop ,
@@ -413,7 +413,7 @@ def encode(obj):
413413 elif isinstance (obj , PeriodIndex ):
414414 return {
415415 "typ" : "period_index" ,
416- "klass" : obj . __class__ .__name__ ,
416+ "klass" : type ( obj ) .__name__ ,
417417 "name" : getattr (obj , "name" , None ),
418418 "freq" : getattr (obj , "freqstr" , None ),
419419 "dtype" : obj .dtype .name ,
@@ -429,7 +429,7 @@ def encode(obj):
429429 obj = obj .tz_convert ("UTC" )
430430 return {
431431 "typ" : "datetime_index" ,
432- "klass" : obj . __class__ .__name__ ,
432+ "klass" : type ( obj ) .__name__ ,
433433 "name" : getattr (obj , "name" , None ),
434434 "dtype" : obj .dtype .name ,
435435 "data" : convert (obj .asi8 ),
@@ -444,7 +444,7 @@ def encode(obj):
444444 typ = "interval_array"
445445 return {
446446 "typ" : typ ,
447- "klass" : obj . __class__ .__name__ ,
447+ "klass" : type ( obj ) .__name__ ,
448448 "name" : getattr (obj , "name" , None ),
449449 "left" : getattr (obj , "left" , None ),
450450 "right" : getattr (obj , "right" , None ),
@@ -453,7 +453,7 @@ def encode(obj):
453453 elif isinstance (obj , MultiIndex ):
454454 return {
455455 "typ" : "multi_index" ,
456- "klass" : obj . __class__ .__name__ ,
456+ "klass" : type ( obj ) .__name__ ,
457457 "names" : getattr (obj , "names" , None ),
458458 "dtype" : obj .dtype .name ,
459459 "data" : convert (obj .values ),
@@ -462,7 +462,7 @@ def encode(obj):
462462 else :
463463 return {
464464 "typ" : "index" ,
465- "klass" : obj . __class__ .__name__ ,
465+ "klass" : type ( obj ) .__name__ ,
466466 "name" : getattr (obj , "name" , None ),
467467 "dtype" : obj .dtype .name ,
468468 "data" : convert (obj .values ),
@@ -472,7 +472,7 @@ def encode(obj):
472472 elif isinstance (obj , Categorical ):
473473 return {
474474 "typ" : "category" ,
475- "klass" : obj . __class__ .__name__ ,
475+ "klass" : type ( obj ) .__name__ ,
476476 "name" : getattr (obj , "name" , None ),
477477 "codes" : obj .codes ,
478478 "categories" : obj .categories ,
@@ -483,7 +483,7 @@ def encode(obj):
483483 elif isinstance (obj , Series ):
484484 return {
485485 "typ" : "series" ,
486- "klass" : obj . __class__ .__name__ ,
486+ "klass" : type ( obj ) .__name__ ,
487487 "name" : getattr (obj , "name" , None ),
488488 "index" : obj .index ,
489489 "dtype" : obj .dtype .name ,
@@ -498,15 +498,15 @@ def encode(obj):
498498 # the block manager
499499 return {
500500 "typ" : "block_manager" ,
501- "klass" : obj . __class__ .__name__ ,
501+ "klass" : type ( obj ) .__name__ ,
502502 "axes" : data .axes ,
503503 "blocks" : [
504504 {
505505 "locs" : b .mgr_locs .as_array ,
506506 "values" : convert (b .values ),
507507 "shape" : b .values .shape ,
508508 "dtype" : b .dtype .name ,
509- "klass" : b . __class__ .__name__ ,
509+ "klass" : type ( b ) .__name__ ,
510510 "compress" : compressor ,
511511 }
512512 for b in data .blocks
@@ -553,15 +553,15 @@ def encode(obj):
553553 elif isinstance (obj , BlockIndex ):
554554 return {
555555 "typ" : "block_index" ,
556- "klass" : obj . __class__ .__name__ ,
556+ "klass" : type ( obj ) .__name__ ,
557557 "blocs" : obj .blocs ,
558558 "blengths" : obj .blengths ,
559559 "length" : obj .length ,
560560 }
561561 elif isinstance (obj , IntIndex ):
562562 return {
563563 "typ" : "int_index" ,
564- "klass" : obj . __class__ .__name__ ,
564+ "klass" : type ( obj ) .__name__ ,
565565 "indices" : obj .indices ,
566566 "length" : obj .length ,
567567 }
0 commit comments