A class for reordering and batching elements of an array.
This class allows for sorting an array based on a provided sorting function, grouping elements based on a grouping function, and generating batches from the sorted and grouped data.
"""
def__init__(
self,
arr:List,
sort_fn:Callable,
group_fn:Callable=lambdax:x[1],
grouping:bool=False,
)->None:
self.grouping=grouping
self.fn=sort_fn
self.group_fn=lambdax:group_fn(x[1])# first index are enumerated indices
If your your compiler isn't linked to python, you may need to add to the above `-undefined dynamic_lookup`
MacOS users: If your compiler isn't linked to Python, you may need to add to the above `-undefined dynamic_lookup`. \
Linux users: If your compiler isn't linked to Python, you may need to follow these steps:
1. Rename the compiled code file to `janitor_util.so`.
2. Before running `import Janitor` in your code, add `sys.path.append("your/relative/path/to/janitor_util.so")` so that Python knows the location of `janitor_util.so`.