def _reconstruct_object(typ, obj, axes, dtype):
 try:
  typ = typ.type
 except AttributeError:
  pass
 res_t = np.result_type(obj.dtype, dtype)
 if ((not isinstance(typ, partial)) and issubclass(typ, pd.core.generic.PandasObject)):
  return typ(obj, dtype=res_t, **axes)
 if (hasattr(res_t, 'type') and (typ == np.bool_) and (res_t != np.bool_)):
  ret_value = res_t.type(obj)
 else:
  ret_value = typ(obj).astype(res_t)
  if ((len(obj.shape) == 1) and (len(obj) == 1)):
   if (not isinstance(ret_value, np.ndarray)):
    ret_value = np.array([ret_value]).astype(res_t)
 return ret_value

def _reconstruct_object ( typ , obj , axes , dtype ) : try : typ = typ . type except AttributeError : pass res_t = np . result_type ( obj . dtype , dtype ) if ( ( not isinstance ( typ , partial ) ) and issubclass ( typ , pd . core . generic . PandasObject ) ) : return typ ( obj , dtype = res_t , ** axes ) if ( hasattr ( res_t , 'type' ) and ( typ == np . bool_ ) and ( res_t != np . bool_ ) ) : ret_value = res_t . type ( obj ) else : ret_value = typ ( obj ) . astype ( res_t ) if ( ( len ( obj . shape ) == 1 ) and ( len ( obj ) == 1 ) ) : if ( not isinstance ( ret_value , np . ndarray ) ) : ret_value = np . array ( [ ret_value ] ) . astype ( res_t ) return ret_value
reconstruct an object given its type .