def coerce_core(result, dshape, odo_kwargs=None):
 if iscoretype(result):
  return result
 elif isscalar(dshape):
  result = coerce_scalar(result, dshape, odo_kwargs=odo_kwargs)
 elif (istabular(dshape) and isrecord(dshape.measure)):
  result = into(DataFrame, result, **(odo_kwargs or {}))
 elif iscollection(dshape):
  dim = _dimensions(dshape)
  if (dim == 1):
   result = into(Series, result, **(odo_kwargs or {}))
  elif (dim > 1):
   result = into(np.ndarray, result, **(odo_kwargs or {}))
  else:
   msg = 'Expr with dshape dimensions < 1 should have been handled earlier: dim={}'
   raise ValueError(msg.format(str(dim)))
 else:
  msg = 'Expr does not evaluate to a core return type'
  raise ValueError(msg)
 return result

def coerce_core ( result , dshape , odo_kwargs = None ) : if iscoretype ( result ) : return result elif isscalar ( dshape ) : result = coerce_scalar ( result , dshape , odo_kwargs = odo_kwargs ) elif ( istabular ( dshape ) and isrecord ( dshape . measure ) ) : result = into ( DataFrame , result , ** ( odo_kwargs or { } ) ) elif iscollection ( dshape ) : dim = _dimensions ( dshape ) if ( dim == 1 ) : result = into ( Series , result , ** ( odo_kwargs or { } ) ) elif ( dim > 1 ) : result = into ( np . ndarray , result , ** ( odo_kwargs or { } ) ) else : msg = 'Expr with dshape dimensions < 1 should have been handled earlier: dim={}' raise ValueError ( msg . format ( str ( dim ) ) ) else : msg = 'Expr does not evaluate to a core return type' raise ValueError ( msg ) return result
coerce data to a core data type .