def _dtype_to_default_stata_fmt(dtype):
 if (dtype.type == np.string_):
  return (('%' + str(dtype.itemsize)) + 's')
 elif (dtype.type == np.object_):
  return '%244s'
 elif (dtype == np.float64):
  return '%10.0g'
 elif (dtype == np.float32):
  return '%9.0g'
 elif (dtype == np.int64):
  return '%9.0g'
 elif (dtype == np.int32):
  return '%8.0g'
 elif ((dtype == np.int8) or (dtype == np.int16)):
  return '%8.0g'
 else:
  raise ValueError(('Data type %s not currently understood. Please report an error to the developers.' % dtype))

def _dtype_to_default_stata_fmt ( dtype ) : if ( dtype . type == np . string_ ) : return ( ( '%' + str ( dtype . itemsize ) ) + 's' ) elif ( dtype . type == np . object_ ) : return '%244s' elif ( dtype == np . float64 ) : return '%10.0g' elif ( dtype == np . float32 ) : return '%9.0g' elif ( dtype == np . int64 ) : return '%9.0g' elif ( dtype == np . int32 ) : return '%8.0g' elif ( ( dtype == np . int8 ) or ( dtype == np . int16 ) ) : return '%8.0g' else : raise ValueError ( ( 'Data type %s not currently understood. Please report an error to the developers.' % dtype ) )
maps numpy dtype to statas default format for this type .