def filter_dataset(
    dataset: pd.DataFrame,
    category_column: str,
    name_column: str,
    all_rows: bool = False,
) -> pd.DataFrame:
    """
    Filter dataset to include only rows with missing categories but existing names.

    Args:
        dataset: Dataset to filter
        category_column: Column name containing categories
        name_column: Column name containing instrument names
        all_rows: If True, include all rows with non-null names regardless of category status

    Returns:
        Filtered DataFrame containing rows matching the filter criteria
    """
    if all_rows:
        return dataset[~dataset[name_column].isna()]
    return dataset[dataset[category_column].isna() & ~dataset[name_column].isna()]

    Filter dataset to include only rows with missing categories but existing names.

    Args:
        dataset: Dataset to filter
        category_column: Column name containing categories
        name_column: Column name containing instrument names
        all_rows: If True, include all rows with non-null names regardless of category status

    Returns:
        Filtered DataFrame containing rows matching the filter criteria
    
parsers/sector_controller.py