microsoft/qlib · error · NotImplementedError

This type of input is not supported

Error message

This type of input is not supported

What it means

Raised by CSZScoreNorm (cross-sectional z-score processor, qlib/data/dataset/processor.py) when its method argument is neither "zscore" nor "robust". The processor maps the method string to a normalization function at construction time; any other string has no implementation. It is a constructor argument error, not a data error.

Source

Thrown at qlib/data/dataset/processor.py:310

        X -= self.mean_train
        X /= self.std_train
        if self.clip_outlier:
            X = np.clip(X, -3, 3)
        df[self.cols] = X
        return df


class CSZScoreNorm(Processor):
    """Cross Sectional ZScore Normalization"""

    def __init__(self, fields_group=None, method="zscore"):
        self.fields_group = fields_group
        if method == "zscore":
            self.zscore_func = zscore
        elif method == "robust":
            self.zscore_func = robust_zscore
        else:
            raise NotImplementedError(f"This type of input is not supported")

    def __call__(self, df):
        # try not modify original dataframe
        if not isinstance(self.fields_group, list):
            self.fields_group = [self.fields_group]
        # depress warning by references:
        # https://stackoverflow.com/questions/20625582/how-to-deal-with-settingwithcopywarning-in-pandas
        # https://pandas.pydata.org/pandas-docs/stable/user_guide/options.html#getting-and-setting-options
        with pd.option_context("mode.chained_assignment", None):
            for g in self.fields_group:
                cols = get_group_columns(df, g)
                df[cols] = df[cols].groupby("datetime", group_keys=False).apply(self.zscore_func)
        return df


class CSRankNorm(Processor):
    """
    Cross Sectional Rank Normalization.

View on GitHub (pinned to 79633dd950)

Solutions

  1. Use method="zscore" for standard cross-sectional z-score or method="robust" for robust z-score (median and MAD).
  2. Check spelling and case: the comparison is exact equality against "zscore" and "robust".
  3. If you need min-max or rank normalization, use the appropriate processor class (e.g. CSRankNorm,MinMaxProcessor) instead of CSZScoreNorm.

Example fix

# before
proc = CSZScoreNorm(fields_group="feature", method="minmax")

# after
proc = CSZScoreNorm(fields_group="feature", method="zscore")  # or "robust"
Defensive patterns

Strategy: validation

Validate before calling

VALID = {"zscore", "robust"}
method = method if method in VALID else "zscore"  # or raise early with a clear message

Type guard

def is_csz_method(m: str) -> bool:
    return m in ("zscore", "robust")

Try / catch

try:
    proc = CSZScoreNorm(fields_group=g, method=m)
except NotImplementedError:
    logger.warning("unsupported CSZScoreNorm method %s; falling back to zscore", m)
    proc = CSZScoreNorm(fields_group=g, method="zscore")

Prevention

When it happens

Trigger: CSZScoreNorm(method="minmax"), CSZScoreNorm(method="ZScore") (case-sensitive), or passing method=None. Occurs when building processor lists in DataHandlerLP config, e.g. processors: [{"class": "CSZScoreNorm", "kwargs": {"method": "z-score"}}].

Common situations: Copy-pasting processor configs from examples and editing the method; assuming case-insensitive matching; confusing this processor with CSRankNorm or ZScoreNorm which have different options. The only valid values are "zscore" (standard) and "robust" (median/MAD-based, robust to outliers).

Related errors


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/de14bdd403ac7c80. Report an issue: GitHub.