prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  EHN: New accessor `fillna_regresssion`
  <!--
  Thanks for contributing a pull request!
  
  Please follow these standard acronyms to start the commit message:
  
  - ENH: enhancement
  - BUG: bug fix
  - DOC: documentation
  - TYP: type annotations
  - TST: addition or modification of tests
  - MAINT: maintenance commit (refactoring, typos, etc.)
  - BLD: change related to building
  - REL: related to releasing
  - API: an (incompatible) API change
  - DEP: deprecate something, or remove a deprecated object
  - DEV: development tool or utility
  - REV: revert an earlier commit
  - PERF: performance improvement
  - BOT: always commit via a bot
  - CI: related to CI or CD
  - CLN: Code cleanup
  -->
  
  - [ ] closes #xxxx
  - [x] whatsnew entry
  
  Fill na value with regression method
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `dtoolkit/accessor/dataframe/fillna_regression.py`
  Content:
  ```
  1 from __future__ import annotations
  2 
  3 from typing import TYPE_CHECKING
  4 
  5 import pandas as pd
  6 
  7 from dtoolkit._typing import IntOrStr
  8 from dtoolkit.accessor.register import register_dataframe_method
  9 
  10 if TYPE_CHECKING:
  11     from sklearn.base import RegressorMixin
  12 
  13 
  14 @register_dataframe_method
  15 def fillna_regression(
  16     df: pd.DataFrame,
  17     method: RegressorMixin,
  18     X: IntOrStr | list[IntOrStr] | pd.Index,
  19     y: IntOrStr,
  20     how: str = "na",
  21     **kwargs,
  22 ) -> pd.DataFrame:
  23     """
  24     Fill na value with regression algorithm.
  25 
  26     Parameters
  27     ----------
  28     method : RegressorMixin
  29         Regression transformer.
  30 
  31     X : int or str, list of int or str, Index
  32         Feature columns.
  33 
  34     y : int or str
  35         Target column.
  36 
  37     how : {'na', 'all'}, default 'na'
  38         Only fill na value or apply regression to entire target column.
  39 
  40     **kwargs
  41         See the documentation for ``method`` for complete details on
  42         the keyword arguments.
  43 
  44     See Also
  45     --------
  46     sklearn.kernel_ridge
  47     sklearn.linear_model
  48     sklearn.dummy.DummyRegressor
  49     sklearn.ensemble.AdaBoostRegressor
  50     sklearn.ensemble.BaggingRegressor
  51     sklearn.ensemble.ExtraTreesRegressor
  52     sklearn.ensemble.GradientBoostingRegressor
  53     sklearn.ensemble.RandomForestRegressor
  54     sklearn.ensemble.StackingRegressor
  55     sklearn.ensemble.VotingRegressor
  56     sklearn.ensemble.HistGradientBoostingRegressor
  57     sklearn.gaussian_process.GaussianProcessRegressor
  58     sklearn.isotonic.IsotonicRegression
  59     sklearn.kernel_ridge.KernelRidge
  60     sklearn.neighbors.KNeighborsRegressor
  61     sklearn.neighbors.RadiusNeighborsRegressor
  62     sklearn.neural_network.MLPRegressor
  63     sklearn.svm.LinearSVR
  64     sklearn.svm.NuSVR
  65     sklearn.svm.SVR
  66     sklearn.tree.DecisionTreeRegressor
  67     sklearn.tree.ExtraTreeRegressor
  68 
  69     Examples
  70     --------
  71     >>> import dtoolkit.accessor
  72     >>> import pandas as pd
  73     >>> from sklearn.linear_model import LinearRegression
  74 
  75     .. math:: y = 1 \\times x_0 + 2 \\times x_1 + 3
  76 
  77     >>> df = pd.DataFrame(
  78     ...     [
  79     ...         [1, 1, 6],
  80     ...         [1, 2, 8],
  81     ...         [2, 2, 9],
  82     ...         [2, 3, 11],
  83     ...         [3, 5, None],
  84     ...     ],
  85     ...     columns=['x1', 'x2', 'y'],
  86     ... )
  87     >>> df
  88        x1  x2     y
  89     0   1   1   6.0
  90     1   1   2   8.0
  91     2   2   2   9.0
  92     3   2   3  11.0
  93     4   3   5   NaN
  94 
  95     Use 'x1' and 'x2' columns to fit 'y' column and fill the value.
  96 
  97     >>> df.fillna_regression(LinearRegression, ['x1', 'x2'], 'y')
  98        x1  x2     y
  99     0   1   1   6.0
  100     1   1   2   8.0
  101     2   2   2   9.0
  102     3   2   3  11.0
  103     4   3   5  16.0
  104     """
  105 
  106     if how not in {"na", "all"}:
  107         raise ValueError(f"invalid inf option: {how!r}")
  108 
  109     if isinstance(X, (str, int)):
  110         X = [X]
  111 
  112     index_notnull = df[df[y].notnull()].index
  113     model = method(**kwargs).fit(
  114         df.loc[index_notnull, X],
  115         df.loc[index_notnull, y],
  116     )
  117 
  118     if how == "all":
  119         df[y] = model.predict(df[X])
  120     elif how == "na":
  121         index_null = df[df[y].isnull()].index
  122         df.loc[index_null, y] = model.predict(df.loc[index_null, X])
  123 
  124     return df
  125
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/dtoolkit/accessor/dataframe/fillna_regression.py b/dtoolkit/accessor/dataframe/fillna_regression.py
  --- a/dtoolkit/accessor/dataframe/fillna_regression.py
  +++ b/dtoolkit/accessor/dataframe/fillna_regression.py
  @@ -15,8 +15,7 @@
   def fillna_regression(
       df: pd.DataFrame,
       method: RegressorMixin,
  -    X: IntOrStr | list[IntOrStr] | pd.Index,
  -    y: IntOrStr,
  +    columns: dict[IntOrStr, IntOrStr | list[IntOrStr] | pd.Index],
       how: str = "na",
       **kwargs,
   ) -> pd.DataFrame:
  @@ -28,11 +27,9 @@
       method : RegressorMixin
           Regression transformer.
   
  -    X : int or str, list of int or str, Index
  -        Feature columns.
  -
  -    y : int or str
  -        Target column.
  +    columns : dict, ``{y: X}``
  +        A series of column names pairs. The key is the y (or target) column name, and
  +        values are X (or feature) column names.
   
       how : {'na', 'all'}, default 'na'
           Only fill na value or apply regression to entire target column.
  @@ -41,6 +38,10 @@
           See the documentation for ``method`` for complete details on
           the keyword arguments.
   
  +    Returns
  +    -------
  +    DataFrame
  +
       See Also
       --------
       sklearn.kernel_ridge
  @@ -94,7 +95,7 @@
   
       Use 'x1' and 'x2' columns to fit 'y' column and fill the value.
   
  -    >>> df.fillna_regression(LinearRegression, ['x1', 'x2'], 'y')
  +    >>> df.fillna_regression(LinearRegression, {'y': ['x1', 'x2']})
          x1  x2     y
       0   1   1   6.0
       1   1   2   8.0
  @@ -106,6 +107,22 @@
       if how not in {"na", "all"}:
           raise ValueError(f"invalid inf option: {how!r}")
   
  +    for y, X in columns.items():
  +        df = _fillna_regression(df, method, y, X, how=how, **kwargs)
  +
  +    return df
  +
  +
  +def _fillna_regression(
  +    df: pd.DataFrame,
  +    method: RegressorMixin,
  +    y: IntOrStr,
  +    X: IntOrStr | list[IntOrStr] | pd.Index,
  +    how: str = "na",
  +    **kwargs,
  +):
  +    """Fill single na column at once."""
  +
       if isinstance(X, (str, int)):
           X = [X]
  
verification_info: {"golden_diff": "diff --git a/dtoolkit/accessor/dataframe/fillna_regression.py b/dtoolkit/accessor/dataframe/fillna_regression.py\n--- a/dtoolkit/accessor/dataframe/fillna_regression.py\n+++ b/dtoolkit/accessor/dataframe/fillna_regression.py\n@@ -15,8 +15,7 @@\n def fillna_regression(\n     df: pd.DataFrame,\n     method: RegressorMixin,\n-    X: IntOrStr | list[IntOrStr] | pd.Index,\n-    y: IntOrStr,\n+    columns: dict[IntOrStr, IntOrStr | list[IntOrStr] | pd.Index],\n     how: str = \"na\",\n     **kwargs,\n ) -> pd.DataFrame:\n@@ -28,11 +27,9 @@\n     method : RegressorMixin\n         Regression transformer.\n \n-    X : int or str, list of int or str, Index\n-        Feature columns.\n-\n-    y : int or str\n-        Target column.\n+    columns : dict, ``{y: X}``\n+        A series of column names pairs. The key is the y (or target) column name, and\n+        values are X (or feature) column names.\n \n     how : {'na', 'all'}, default 'na'\n         Only fill na value or apply regression to entire target column.\n@@ -41,6 +38,10 @@\n         See the documentation for ``method`` for complete details on\n         the keyword arguments.\n \n+    Returns\n+    -------\n+    DataFrame\n+\n     See Also\n     --------\n     sklearn.kernel_ridge\n@@ -94,7 +95,7 @@\n \n     Use 'x1' and 'x2' columns to fit 'y' column and fill the value.\n \n-    >>> df.fillna_regression(LinearRegression, ['x1', 'x2'], 'y')\n+    >>> df.fillna_regression(LinearRegression, {'y': ['x1', 'x2']})\n        x1  x2     y\n     0   1   1   6.0\n     1   1   2   8.0\n@@ -106,6 +107,22 @@\n     if how not in {\"na\", \"all\"}:\n         raise ValueError(f\"invalid inf option: {how!r}\")\n \n+    for y, X in columns.items():\n+        df = _fillna_regression(df, method, y, X, how=how, **kwargs)\n+\n+    return df\n+\n+\n+def _fillna_regression(\n+    df: pd.DataFrame,\n+    method: RegressorMixin,\n+    y: IntOrStr,\n+    X: IntOrStr | list[IntOrStr] | pd.Index,\n+    how: str = \"na\",\n+    **kwargs,\n+):\n+    \"\"\"Fill single na column at once.\"\"\"\n+\n     if isinstance(X, (str, int)):\n         X = [X]\n", "issue": "EHN: New accessor `fillna_regresssion`\n<!--\r\nThanks for contributing a pull request!\r\n\r\nPlease follow these standard acronyms to start the commit message:\r\n\r\n- ENH: enhancement\r\n- BUG: bug fix\r\n- DOC: documentation\r\n- TYP: type annotations\r\n- TST: addition or modification of tests\r\n- MAINT: maintenance commit (refactoring, typos, etc.)\r\n- BLD: change related to building\r\n- REL: related to releasing\r\n- API: an (incompatible) API change\r\n- DEP: deprecate something, or remove a deprecated object\r\n- DEV: development tool or utility\r\n- REV: revert an earlier commit\r\n- PERF: performance improvement\r\n- BOT: always commit via a bot\r\n- CI: related to CI or CD\r\n- CLN: Code cleanup\r\n-->\r\n\r\n- [ ] closes #xxxx\r\n- [x] whatsnew entry\r\n\r\nFill na value with regression method\r\n\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nimport pandas as pd\n\nfrom dtoolkit._typing import IntOrStr\nfrom dtoolkit.accessor.register import register_dataframe_method\n\nif TYPE_CHECKING:\n    from sklearn.base import RegressorMixin\n\n\n@register_dataframe_method\ndef fillna_regression(\n    df: pd.DataFrame,\n    method: RegressorMixin,\n    X: IntOrStr | list[IntOrStr] | pd.Index,\n    y: IntOrStr,\n    how: str = \"na\",\n    **kwargs,\n) -> pd.DataFrame:\n    \"\"\"\n    Fill na value with regression algorithm.\n\n    Parameters\n    ----------\n    method : RegressorMixin\n        Regression transformer.\n\n    X : int or str, list of int or str, Index\n        Feature columns.\n\n    y : int or str\n        Target column.\n\n    how : {'na', 'all'}, default 'na'\n        Only fill na value or apply regression to entire target column.\n\n    **kwargs\n        See the documentation for ``method`` for complete details on\n        the keyword arguments.\n\n    See Also\n    --------\n    sklearn.kernel_ridge\n    sklearn.linear_model\n    sklearn.dummy.DummyRegressor\n    sklearn.ensemble.AdaBoostRegressor\n    sklearn.ensemble.BaggingRegressor\n    sklearn.ensemble.ExtraTreesRegressor\n    sklearn.ensemble.GradientBoostingRegressor\n    sklearn.ensemble.RandomForestRegressor\n    sklearn.ensemble.StackingRegressor\n    sklearn.ensemble.VotingRegressor\n    sklearn.ensemble.HistGradientBoostingRegressor\n    sklearn.gaussian_process.GaussianProcessRegressor\n    sklearn.isotonic.IsotonicRegression\n    sklearn.kernel_ridge.KernelRidge\n    sklearn.neighbors.KNeighborsRegressor\n    sklearn.neighbors.RadiusNeighborsRegressor\n    sklearn.neural_network.MLPRegressor\n    sklearn.svm.LinearSVR\n    sklearn.svm.NuSVR\n    sklearn.svm.SVR\n    sklearn.tree.DecisionTreeRegressor\n    sklearn.tree.ExtraTreeRegressor\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> from sklearn.linear_model import LinearRegression\n\n    .. math:: y = 1 \\\\times x_0 + 2 \\\\times x_1 + 3\n\n    >>> df = pd.DataFrame(\n    ...     [\n    ...         [1, 1, 6],\n    ...         [1, 2, 8],\n    ...         [2, 2, 9],\n    ...         [2, 3, 11],\n    ...         [3, 5, None],\n    ...     ],\n    ...     columns=['x1', 'x2', 'y'],\n    ... )\n    >>> df\n       x1  x2     y\n    0   1   1   6.0\n    1   1   2   8.0\n    2   2   2   9.0\n    3   2   3  11.0\n    4   3   5   NaN\n\n    Use 'x1' and 'x2' columns to fit 'y' column and fill the value.\n\n    >>> df.fillna_regression(LinearRegression, ['x1', 'x2'], 'y')\n       x1  x2     y\n    0   1   1   6.0\n    1   1   2   8.0\n    2   2   2   9.0\n    3   2   3  11.0\n    4   3   5  16.0\n    \"\"\"\n\n    if how not in {\"na\", \"all\"}:\n        raise ValueError(f\"invalid inf option: {how!r}\")\n\n    if isinstance(X, (str, int)):\n        X = [X]\n\n    index_notnull = df[df[y].notnull()].index\n    model = method(**kwargs).fit(\n        df.loc[index_notnull, X],\n        df.loc[index_notnull, y],\n    )\n\n    if how == \"all\":\n        df[y] = model.predict(df[X])\n    elif how == \"na\":\n        index_null = df[df[y].isnull()].index\n        df.loc[index_null, y] = model.predict(df.loc[index_null, X])\n\n    return df\n", "path": "dtoolkit/accessor/dataframe/fillna_regression.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nimport pandas as pd\n\nfrom dtoolkit._typing import IntOrStr\nfrom dtoolkit.accessor.register import register_dataframe_method\n\nif TYPE_CHECKING:\n    from sklearn.base import RegressorMixin\n\n\n@register_dataframe_method\ndef fillna_regression(\n    df: pd.DataFrame,\n    method: RegressorMixin,\n    columns: dict[IntOrStr, IntOrStr | list[IntOrStr] | pd.Index],\n    how: str = \"na\",\n    **kwargs,\n) -> pd.DataFrame:\n    \"\"\"\n    Fill na value with regression algorithm.\n\n    Parameters\n    ----------\n    method : RegressorMixin\n        Regression transformer.\n\n    columns : dict, ``{y: X}``\n        A series of column names pairs. The key is the y (or target) column name, and\n        values are X (or feature) column names.\n\n    how : {'na', 'all'}, default 'na'\n        Only fill na value or apply regression to entire target column.\n\n    **kwargs\n        See the documentation for ``method`` for complete details on\n        the keyword arguments.\n\n    Returns\n    -------\n    DataFrame\n\n    See Also\n    --------\n    sklearn.kernel_ridge\n    sklearn.linear_model\n    sklearn.dummy.DummyRegressor\n    sklearn.ensemble.AdaBoostRegressor\n    sklearn.ensemble.BaggingRegressor\n    sklearn.ensemble.ExtraTreesRegressor\n    sklearn.ensemble.GradientBoostingRegressor\n    sklearn.ensemble.RandomForestRegressor\n    sklearn.ensemble.StackingRegressor\n    sklearn.ensemble.VotingRegressor\n    sklearn.ensemble.HistGradientBoostingRegressor\n    sklearn.gaussian_process.GaussianProcessRegressor\n    sklearn.isotonic.IsotonicRegression\n    sklearn.kernel_ridge.KernelRidge\n    sklearn.neighbors.KNeighborsRegressor\n    sklearn.neighbors.RadiusNeighborsRegressor\n    sklearn.neural_network.MLPRegressor\n    sklearn.svm.LinearSVR\n    sklearn.svm.NuSVR\n    sklearn.svm.SVR\n    sklearn.tree.DecisionTreeRegressor\n    sklearn.tree.ExtraTreeRegressor\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> from sklearn.linear_model import LinearRegression\n\n    .. math:: y = 1 \\\\times x_0 + 2 \\\\times x_1 + 3\n\n    >>> df = pd.DataFrame(\n    ...     [\n    ...         [1, 1, 6],\n    ...         [1, 2, 8],\n    ...         [2, 2, 9],\n    ...         [2, 3, 11],\n    ...         [3, 5, None],\n    ...     ],\n    ...     columns=['x1', 'x2', 'y'],\n    ... )\n    >>> df\n       x1  x2     y\n    0   1   1   6.0\n    1   1   2   8.0\n    2   2   2   9.0\n    3   2   3  11.0\n    4   3   5   NaN\n\n    Use 'x1' and 'x2' columns to fit 'y' column and fill the value.\n\n    >>> df.fillna_regression(LinearRegression, {'y': ['x1', 'x2']})\n       x1  x2     y\n    0   1   1   6.0\n    1   1   2   8.0\n    2   2   2   9.0\n    3   2   3  11.0\n    4   3   5  16.0\n    \"\"\"\n\n    if how not in {\"na\", \"all\"}:\n        raise ValueError(f\"invalid inf option: {how!r}\")\n\n    for y, X in columns.items():\n        df = _fillna_regression(df, method, y, X, how=how, **kwargs)\n\n    return df\n\n\ndef _fillna_regression(\n    df: pd.DataFrame,\n    method: RegressorMixin,\n    y: IntOrStr,\n    X: IntOrStr | list[IntOrStr] | pd.Index,\n    how: str = \"na\",\n    **kwargs,\n):\n    \"\"\"Fill single na column at once.\"\"\"\n\n    if isinstance(X, (str, int)):\n        X = [X]\n\n    index_notnull = df[df[y].notnull()].index\n    model = method(**kwargs).fit(\n        df.loc[index_notnull, X],\n        df.loc[index_notnull, y],\n    )\n\n    if how == \"all\":\n        df[y] = model.predict(df[X])\n    elif how == \"na\":\n        index_null = df[df[y].isnull()].index\n        df.loc[index_null, y] = model.predict(df.loc[index_null, X])\n\n    return df\n", "path": "dtoolkit/accessor/dataframe/fillna_regression.py"}]}