def interpret_data(data, colnames=None, rownames=None):
 if isinstance(data, np.ndarray):
  if _is_structured_ndarray(data):
   if (colnames is None):
    colnames = data.dtype.names
   values = struct_to_ndarray(data)
  else:
   values = data
  if (colnames is None):
   colnames = [('Y_%d' % i) for i in range(values.shape[1])]
 elif is_data_frame(data):
  data = data.dropna()
  values = data.values
  colnames = data.columns
  rownames = data.index
 else:
  raise Exception('cannot handle other input types at the moment')
 if (not isinstance(colnames, list)):
  colnames = list(colnames)
 if (len(colnames) != values.shape[1]):
  raise ValueError('length of colnames does not match number of columns in data')
 if ((rownames is not None) and (len(rownames) != len(values))):
  raise ValueError('length of rownames does not match number of rows in data')
 return (values, colnames, rownames)

def interpret_data ( data , colnames = None , rownames = None ) : if isinstance ( data , np . ndarray ) : if _is_structured_ndarray ( data ) : if ( colnames is None ) : colnames = data . dtype . names values = struct_to_ndarray ( data ) else : values = data if ( colnames is None ) : colnames = [ ( 'Y_%d' % i ) for i in range ( values . shape [ 1 ] ) ] elif is_data_frame ( data ) : data = data . dropna ( ) values = data . values colnames = data . columns rownames = data . index else : raise Exception ( 'cannot handle other input types at the moment' ) if ( not isinstance ( colnames , list ) ) : colnames = list ( colnames ) if ( len ( colnames ) != values . shape [ 1 ] ) : raise ValueError ( 'length of colnames does not match number of columns in data' ) if ( ( rownames is not None ) and ( len ( rownames ) != len ( values ) ) ) : raise ValueError ( 'length of rownames does not match number of rows in data' ) return ( values , colnames , rownames )
convert passed data structure to form required by estimation classes parameters data : ndarray-like colnames : sequence or none may be part of data structure rownames : sequence or none returns : .