def names_to_indices(names, ordered_names):
 indices = []
 names_list = list(names)
 for ordered_name in ordered_names:
  if (ordered_name in names_list):
   indices.append(names_list.index(ordered_name))
 return np.array(indices)

def names_to_indices ( names , ordered_names ) : indices = [ ] names_list = list ( names ) for ordered_name in ordered_names : if ( ordered_name in names_list ) : indices . append ( names_list . index ( ordered_name ) ) return np . array ( indices )
returns the indices that would sort names like ordered_names .