def _dtype_to_stata_type(dtype, column):
 if (dtype.type == np.string_):
  return chr(dtype.itemsize)
 elif (dtype.type == np.object_):
  itemsize = max_len_string_array(_ensure_object(column.values))
  return chr(max(itemsize, 1))
 elif (dtype == np.float64):
  return chr(255)
 elif (dtype == np.float32):
  return chr(254)
 elif (dtype == np.int32):
  return chr(253)
 elif (dtype == np.int16):
  return chr(252)
 elif (dtype == np.int8):
  return chr(251)
 else:
  raise NotImplementedError(('Data type %s not supported.' % dtype))

def _dtype_to_stata_type ( dtype , column ) : if ( dtype . type == np . string_ ) : return chr ( dtype . itemsize ) elif ( dtype . type == np . object_ ) : itemsize = max_len_string_array ( _ensure_object ( column . values ) ) return chr ( max ( itemsize , 1 ) ) elif ( dtype == np . float64 ) : return chr ( 255 ) elif ( dtype == np . float32 ) : return chr ( 254 ) elif ( dtype == np . int32 ) : return chr ( 253 ) elif ( dtype == np . int16 ) : return chr ( 252 ) elif ( dtype == np . int8 ) : return chr ( 251 ) else : raise NotImplementedError ( ( 'Data type %s not supported.' % dtype ) )
converts dtype types to stata types .