ds_provider_unimicro_py_lib.utils.dataframe =========================================== .. py:module:: ds_provider_unimicro_py_lib.utils.dataframe .. autoapi-nested-parse:: **File:** ``dataframe.py`` **Region:** ``ds_provider_unimicro_py_lib/utils/dataframe`` Helpers for shaping dataset output frames. Functions --------- .. autoapisummary:: ds_provider_unimicro_py_lib.utils.dataframe.project_fields Module Contents --------------- .. py:function:: project_fields(output: pandas.DataFrame, fields: list[str] | None) -> pandas.DataFrame Restrict the output to ``fields`` (ignoring names that are not present), if configured. :param output: The normalized output dataframe. :param fields: Column names to keep, in the requested order. ``None`` or empty keeps everything. :returns: The projected dataframe, or the input unchanged when ``fields`` is not set. If none of the requested fields exist, an empty frame with the same index is returned. :rtype: pd.DataFrame