def arrange(*args):
  """Sort DataFrame by the input column arguments.

  >>> diamonds >> sample_n(5) >> arrange(X.price) >> select(X.depth, X.price)
  Out:
         depth  price
  28547   61.0    675
  35132   59.1    889
  42526   61.3   1323
  3468    61.6   3392
  23829   62.0  11903
  """
  names = [column._name for column in args]
  def f(df):
    sortby_df = df >> mutate(*args)
    index = sortby_df.sort_values([str(arg) for arg in args]).index
    return df.loc[index]
  return f
def arrange ( * args ) : names = [ column . _name for column in args ] def f ( df ) : sortby_df = df >> mutate ( * args ) index = sortby_df . sort_values ( [ str ( arg ) for arg in args ] ) . index return df . loc [ index ] return f
Sort DataFrame by the input column arguments.

  >>> diamonds >> sample_n(5) >> arrange(X.price) >> select(X.depth, X.price)
  Out:
         depth  price
  28547   61.0    675
  35132   59.1    889
  42526   61.3   1323
  3468    61.6   3392
  23829   62.0  11903