def indexable(*iterables):
 result = []
 for X in iterables:
  if sp.issparse(X):
   result.append(X.tocsr())
  elif (hasattr(X, '__getitem__') or hasattr(X, 'iloc')):
   result.append(X)
  elif (X is None):
   result.append(X)
  else:
   result.append(np.array(X))
 check_consistent_length(*result)
 return result

def indexable ( * iterables ) : result = [ ] for X in iterables : if sp . issparse ( X ) : result . append ( X . tocsr ( ) ) elif ( hasattr ( X , '__getitem__' ) or hasattr ( X , 'iloc' ) ) : result . append ( X ) elif ( X is None ) : result . append ( X ) else : result . append ( np . array ( X ) ) check_consistent_length ( * result ) return result
make arrays indexable for cross-validation .