{"record":{"id":"608f4b10479d9bde","repo":"pandas-dev/pandas","slug":"no-transform-functions-were-provided","errorCode":null,"errorMessage":"No transform functions were provided","messagePattern":"No transform functions were provided","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pandas/core/apply.py","lineNumber":423,"sourceCode":"        ):\n            raise ValueError(\"Function did not transform\")\n\n        return result\n\n    def transform_dict_like(self, func) -> DataFrame:\n        \"\"\"\n        Compute transform in the case of a dict-like func\n        \"\"\"\n\n        obj = self.obj\n        args = self.args\n        kwargs = self.kwargs\n\n        # transform is currently only for Series/DataFrame\n        assert isinstance(obj, ABCNDFrame)\n\n        if len(func) == 0:\n            raise ValueError(\"No transform functions were provided\")\n\n        func = self.normalize_dictlike_arg(\"transform\", obj, func)\n\n        results: dict[Hashable, DataFrame | Series] = {}\n        for name, how in func.items():\n            colg = obj._gotitem(name, ndim=1)\n            results[name] = colg.transform(how, 0, *args, **kwargs)\n        return concat(results, axis=1)\n\n    def transform_str_or_callable(self, func) -> DataFrame | Series:\n        \"\"\"\n        Compute transform in the case of a string or callable func\n        \"\"\"\n        obj = self.obj\n        args = self.args\n        kwargs = self.kwargs\n\n        if isinstance(func, str):","sourceCodeStart":405,"sourceCodeEnd":441,"githubUrl":"https://github.com/pandas-dev/pandas/blob/3b7651241d4da534b3559b60ef128e1c34f54116/pandas/core/apply.py#L405-L441","documentation":"Raised by `transform_dict_like` when the dict-like `func` argument passed to `DataFrame.transform` is empty (`len(func) == 0`). Pandas treats an empty mapping as a user error because there is no operation to perform and silently returning the frame would hide a likely upstream bug. The check fires before any normalization of the dict, so even `{}` after expansion triggers it.","triggerScenarios":"Calling `df.transform({})`, `df.transform(dict())`, or programmatically building a dict of transforms that ends up empty (e.g. `df.transform({k: 'mean' for k in [] if some_condition})`). Also when a Series.transform receives an empty dict.","commonSituations":"Dynamic column-selection logic that filters down to zero columns but still calls transform; configuration-driven pipelines where the transform spec comes from a config file that is empty or fully filtered out; refactoring that leaves a placeholder empty dict.","solutions":["Pass at least one column->function mapping: `df.transform({'col1': 'cumsum'})`.","If building the dict dynamically, guard upstream: `if transform_spec: df.transform(transform_spec)`.","Audit the code that constructs the dict to confirm it is not being emptied by an over-restrictive filter."],"exampleFix":"// before\nspec = {c: 'shift' for c in df.columns if c.startswith('z')}  # empty if no z* columns\ndf.transform(spec)\n// after\nspec = {c: 'shift' for c in df.columns if c.startswith('z')}\nif spec:\n    df.transform(spec)","handlingStrategy":"validation","validationCode":"def transform_or_skip(df, spec):\n    if not spec:\n        return df  # or raise a clearer domain error\n    return df.transform(spec)","typeGuard":"def is_nonempty_dict_spec(spec) -> bool:\n    return isinstance(spec, dict) and len(spec) > 0","tryCatchPattern":"try:\n    out = df.transform(spec)\nexcept ValueError as e:\n    if 'No transform functions' in str(e):\n        out = df  # nothing to do\n    else:\n        raise","preventionTips":["Always assert `spec` is non-empty before passing to transform.","When building specs dynamically, log how many keys survive the filter.","Treat an empty transform spec as a config smell — fail loudly upstream."],"tags":["pandas","transform","empty-input","valueerror"],"backgroundTag":null,"analyzedSha":"3b7651241d4da534b3559b60ef128e1c34f54116","analyzedAt":"2026-08-11T22:10:44.015Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}