> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Level.ordering

<span id="atoti.Level.ordering" />

> *getter setter* Level.ordering: [Ordering](./atoti.ordering.Ordering#atoti.Ordering)

Order in which to sort the level’s members.

Members are sorted in ascending [`direction`](./atoti.ordering.Ordering#atoti.Ordering.direction) by default:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> df = pd.DataFrame({"City": ["Paris", "Berlin", "London"]})
>>> table = session.read_pandas(df, keys={"City"}, table_name="Cities")
>>> cube = session.create_cube(table)
>>> l, m = cube.levels, cube.measures
>>> cube.query(m["contributors.COUNT"], levels=[l["City"]]).index.tolist()
['Berlin', 'London', 'Paris']
```

[`String`](./atoti.type#atoti.type.STRING) and [`object`](./atoti.type#atoti.type.OBJECT) levels default to a `"lexicographic"` [`digits`](./atoti.ordering.StringComparison#atoti.StringComparison.digits) comparison:

```pycon theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
>>> import pprint
>>> table = session.create_table(
...     "Example",
...     data_types={data_type: data_type for data_type in all_level_data_types},
...     keys=all_level_data_types,
... )
>>> cube = session.create_cube(table)
>>> levels = sorted(
...     cube.levels.values(),
...     key=lambda level: (level.name[0].isupper(), level.name),
... )
>>> default_digit_comparison = {
...     level.name: level.ordering.string_comparison.digits for level in levels
... }
>>> pprint.pp(default_digit_comparison)
{'boolean': 'numeric',
 'double': 'numeric',
 'float': 'numeric',
 'int': 'numeric',
 'long': 'numeric',
 'LocalDate': 'numeric',
 'LocalDateTime': 'numeric',
 'LocalTime': 'numeric',
 'Object': 'lexicographic',
 'String': 'lexicographic',
 'ZonedDateTime': 'numeric'}
```

<Info>
  Added in version 6.2.1.
</Info>
