Sortation
tablite.sortation
Attributes
Classes
Functions
tablite.sortation.sort_index(T, mapping, sort_mode='excel', tqdm=_tqdm, pbar=None)
helper for methods sort
and is_sorted
param: sort_mode: str: "alphanumeric", "unix", or, "excel" (default) param: **kwargs: sort criteria. See Table.sort()
Source code in tablite/sortation.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
tablite.sortation.reindex(T, index)
index: list of integers that declare sort order.
Examples:
Table: ['a','b','c','d','e','f','g','h']
index: [0,2,4,6]
result: ['b','d','f','h']
Table: ['a','b','c','d','e','f','g','h']
index: [0,2,4,6,1,3,5,7]
result: ['a','c','e','g','b','d','f','h']
Source code in tablite/sortation.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
tablite.sortation.sort(T, mapping, sort_mode='excel', tqdm=_tqdm, pbar: _tqdm = None)
Perform multi-pass sorting with precedence given order of column names. sort_mode: str: "alphanumeric", "unix", or, "excel" kwargs: keys: columns, values: 'reverse' as boolean.
examples: Table.sort('A'=False) means sort by 'A' in ascending order. Table.sort('A'=True, 'B'=False) means sort 'A' in descending order, then (2nd priority) sort B in ascending order.
Source code in tablite/sortation.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
tablite.sortation.is_sorted(T, mapping, sort_mode='excel')
Performs multi-pass sorting check with precedence given order of column names.
PARAMETER | DESCRIPTION |
---|---|
mapping |
sort criteria. See Table.sort()
|
RETURNS | DESCRIPTION |
---|---|
bool |
Source code in tablite/sortation.py
165 166 167 168 169 170 171 172 173 174 175 176 177 |
|