dataslicer package

Submodules

dataslicer.main module

dataslicer.main.choose_columns(columns: list[str]) list[str][source]

Let the user select columns by number. The selection order will determine the folder hierarchy.

dataslicer.main.choose_export_format() str[source]

Ask the user to choose an export format by number: 1. Excel 2. CSV

dataslicer.main.choose_filename_column(columns: list[str]) str[source]

Let the user select a column to use for the filename or enter a custom string.

dataslicer.main.get_export_folder() str[source]

Keep asking for an export folder until a valid path is provided. If the folder doesn’t exist, try to create it.

dataslicer.main.get_file_path() str[source]

Ask the user for the file path, which can be a file or directory.

dataslicer.main.main() None[source]
dataslicer.main.read_file(file_path: str) DataFrame[source]

Read a single file or all Excel and CSV files in a directory. Ensures all files in a directory have consistent columns.

dataslicer.main.save_group(df: DataFrame, group_keys: Any | tuple[Any, ...], selected_columns: list[str], filename_column: str, export_folder: str, export_format: str) None[source]

Create the nested folder structure based on group_keys and save the subset file. The output filename is based on the value of the filename_column for this group.