Utilities¶
Helper modules and shared functionality.
Columns¶
Column mapping and data structure utilities.
Extracts column information from a file and provides utilities for working with columns in a web form.
- create_column_selections(form_dict) tuple[list[str], list[str]][source]¶
Return a tag prefix dictionary from a form dictionary.
- dataframe_from_worksheet(worksheet, has_column_names) DataFrame[source]¶
Return a pandas data frame from an Excel worksheet.
- Parameters:
worksheet (Worksheet) – A single worksheet of an Excel file.
has_column_names (bool) – If True, interpret the first row as column names.
- Returns:
The data represented in the worksheet.
- Return type:
DataFrame
- get_column_numbers(form_dict) list[source]¶
Return a tag prefix dictionary from a form dictionary.
- Parameters:
form_dict (dict) – The dictionary returned from a form that contains a column table.
- Returns:
List of selected columns.
- Return type:
Note: The form counts columns starting from 1.
- get_columns_request(request) dict[source]¶
Create a columns info dictionary based on the request.
- Parameters:
request (Request) – The Request object from which to extract the information.
- Returns:
The dictionary with the column names.
- Return type:
- Raises:
HedFileError – If the file is missing or has a bad extension.