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.
- hedweb.columns.create_column_selections(form_dict) tuple[list[str], list[str]][source]¶
Return a tag prefix dictionary from a form dictionary.
- hedweb.columns.get_tag_columns(form_dict) list[str][source]¶
Return the tag column names selected from a form.
- hedweb.columns.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
- hedweb.columns.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.
- hedweb.columns.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.