{"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/71959b8cb9b2459c16e14b34f28b178ccfe14735/pandas/core/apply.py#L405-L441","documentation":"Raised inside `transform_dict_like` when the dict of transform functions is empty (`{}`). With no functions specified, there is nothing to compute, so pandas raises rather than silently returning an empty result. This typically happens when the dict is built programmatically and ends up empty.","triggerScenarios":"`df.transform({})`, or `df.transform({k: v for k, v in d.items() if condition})` where the comprehension produces an empty dict. Also calling transform on a GroupBy with an empty dict.","commonSituations":"Filtering a function/col dict dynamically such that all entries are filtered out; refactoring that leaves an empty default; logic errors where the dict is never populated.","solutions":["Guard before calling transform: `if func_dict: df.transform(func_dict)`.","Inspect the source of the dict to ensure at least one valid mapping is present.","Provide a sensible default entry in the dict construction."],"exampleFix":"# before\ndf.transform({k: ['mean'] for k in [] })\n# after\nops = {c: ['mean'] for c in df.select_dtypes('number').columns}\nif ops:\n    df.transform(ops)","handlingStrategy":"validation","validationCode":"def safe_transform(df, func_dict):\n    if not func_dict:\n        raise ValueError('transform dict must be non-empty')\n    return df.transform(func_dict)","typeGuard":"def is_nonempty_dict(d) -> bool:\n    return isinstance(d, dict) and len(d) > 0","tryCatchPattern":"try:\n    df.transform(func_dict)\nexcept ValueError as e:\n    if 'No transform functions were provided' in str(e):\n        # nothing to do; return input unchanged\n        return df\n    raise","preventionTips":["Guard `if func_dict:` before calling transform.","Build function dicts from sources known to be non-empty."],"tags":["pandas","transform","valueerror","empty-input","validation"],"analyzedSha":"71959b8cb9b2459c16e14b34f28b178ccfe14735","analyzedAt":"2026-08-07T01:30:20.476Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}