---
title: "sort(on:_:by:)"
framework: tabulardata
role: symbol
role_heading: Instance Method
path: "tabulardata/dataframe/sort(on:_:by:)"
---

# sort(on:_:by:)

Arranges the rows of a data frame according to a column that you select by its name and type, with a predicate.

## Declaration

```swift
mutating func sort<T>(on columnName: String, _ type: T.Type, by areInIncreasingOrder: (T, T) throws -> Bool) rethrows
```

## Parameters

- `columnName`: The name of a column.
- `type`: The column’s type.
- `areInIncreasingOrder`: A closure that returns a Boolean that indicates whether the two elements are in increasing order.

## Discussion

Discussion note: Elements with a value of nil are less than all non-nil values.

## See Also

### Sorting a Data Frame

- [sort(on:order:)](tabulardata/dataframe/sort(on:order:)-4vns7.md)
- [sort(on:_:order:)](tabulardata/dataframe/sort(on:_:order:)-78avw.md)
- [sort(on:by:)](tabulardata/dataframe/sort(on:by:).md)
- [sort(on:order:)](tabulardata/dataframe/sort(on:order:)-5ep7w.md)
- [sort(on:_:order:)](tabulardata/dataframe/sort(on:_:order:)-8wrkl.md)
- [sort(on:_:_:order:)](tabulardata/dataframe/sort(on:_:_:order:).md)
