We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
DEP: Drop `inplace` for `drop_inf`, no more `inplace`
<!--
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
-->

- [x] closes #531
- [x] whatsnew entry

No more `inplace` option.

--- 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/drop_inf.py`
Content:
```
1 from __future__ import annotations
2 
3 from typing import TYPE_CHECKING
4 
5 import numpy as np
6 import pandas as pd
7 from pandas.util._validators import validate_bool_kwarg
8 
9 from dtoolkit.accessor.dataframe import boolean  # noqa
10 from dtoolkit.accessor.register import register_dataframe_method
11 from dtoolkit.accessor.series.drop_inf import get_inf_range
12 from dtoolkit.util._decorator import deprecated_kwargs
13 
14 
15 if TYPE_CHECKING:
16     from dtoolkit._typing import IntOrStr
17 
18 
19 @register_dataframe_method
20 @deprecated_kwargs(
21     "inplace",
22     message=(
23         "The keyword argument '{argument}' of '{func_name}' is deprecated and will "
24         "be removed in 0.0.17. (Warning added DToolKit 0.0.16)"
25     ),
26 )
27 def drop_inf(
28     df: pd.DataFrame,
29     axis: IntOrStr = 0,
30     how: str = "any",
31     inf: str = "all",
32     subset: list[str] = None,
33     inplace: bool = False,
34 ) -> pd.DataFrame | None:
35     """
36     Remove ``inf`` values.
37 
38     Parameters
39     ----------
40     axis : {0 or 'index', 1 or 'columns'}, default 0
41         Determine if rows or columns which contain ``inf`` values are
42         removed.
43 
44         * 0, or 'index' : Drop rows which contain ``inf`` values.
45         * 1, or 'columns' : Drop columns which contain ``inf`` value.
46 
47     how : {'any', 'all'}, default 'any'
48         Determine if row or column is removed from :obj:`~pandas.DataFrame`,
49         when we have at least one ``inf`` or all ``inf``.
50 
51         * 'any' : If any ``inf`` values are present, drop that row or column.
52         * 'all' : If all values are ``inf``, drop that row or column.
53 
54     inf : {'all', 'pos', '+', 'neg', '-'}, default 'all'
55         * 'all' : Remove ``inf`` and ``-inf``.
56         * 'pos' / '+' : Only remove ``inf``.
57         * 'neg' / '-' : Only remove ``-inf``.
58 
59     subset : array-like, optional
60         Labels along other axis to consider, e.g. if you are dropping rows
61         these would be a list of columns to include.
62 
63     inplace : bool, default False
64         If True, do operation inplace and return None.
65 
66     Returns
67     -------
68     DataFrame or None
69         DataFrame with ``inf`` entries dropped from it or None if
70         ``inplace=True``.
71 
72     See Also
73     --------
74     dtoolkit.accessor.series.drop_inf
75         :obj:`~pandas.Series` drops ``inf`` values.
76 
77     Examples
78     --------
79     >>> import dtoolkit.accessor
80     >>> import pandas as pd
81     >>> import numpy as np
82     >>> df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
83     ...                    "toy": [np.inf, 'Batmobile', 'Bullwhip'],
84     ...                    "born": [np.inf, pd.Timestamp("1940-04-25"),
85     ...                             -np.inf]})
86     >>> df
87            name        toy                 born
88     0    Alfred        inf                  inf
89     1    Batman  Batmobile  1940-04-25 00:00:00
90     2  Catwoman   Bullwhip                 -inf
91 
92     Drop the rows where at least one element is inf and -inf.
93 
94     >>> df.drop_inf()
95          name        toy                 born
96     1  Batman  Batmobile  1940-04-25 00:00:00
97 
98     Drop the columns where at least one element is inf and -inf.
99 
100     >>> df.drop_inf(axis='columns')
101            name
102     0    Alfred
103     1    Batman
104     2  Catwoman
105 
106     Drop the rows where all elements are inf and -inf.
107 
108     >>> df.drop_inf(how='all')
109            name        toy                 born
110     0    Alfred        inf                  inf
111     1    Batman  Batmobile  1940-04-25 00:00:00
112     2  Catwoman   Bullwhip                 -inf
113 
114     Drop the rows where at least one element is -inf.
115 
116     >>> df.drop_inf(inf='neg')
117            name        toy                 born
118     0    Alfred        inf                  inf
119     1    Batman  Batmobile  1940-04-25 00:00:00
120 
121     Define in which columns to look for inf and -inf values.
122 
123     >>> df.drop_inf(subset=['name', 'toy'])
124            name        toy                 born
125     1    Batman  Batmobile  1940-04-25 00:00:00
126     2  Catwoman   Bullwhip                 -inf
127 
128     Keep the DataFrame with valid entries in the same variable.
129 
130     >>> df.drop_inf(inplace=True)
131     >>> df
132            name        toy                 born
133     1    Batman  Batmobile  1940-04-25 00:00:00
134     """
135 
136     inplace = validate_bool_kwarg(inplace, "inplace")
137     inf_range = get_inf_range(inf)
138     axis = df._get_axis_number(axis)
139     agg_axis = 1 - axis
140 
141     agg_obj = df
142     if subset is not None:
143         ax = df._get_axis(agg_axis)
144         indices = ax.get_indexer_for(subset)
145         check = indices == -1
146         if check.any():
147             raise KeyError(list(np.compress(check, subset)))
148 
149         agg_obj = df.take(indices, axis=agg_axis)
150 
151     mask = agg_obj.isin(inf_range).boolean(how=how, axis=agg_axis)
152     result = df.loc(axis=axis)[~mask]
153 
154     if not inplace:
155         return result
156 
157     df._update_inplace(result)
158
```

Path: `dtoolkit/accessor/series/drop_inf.py`
Content:
```
1 from __future__ import annotations
2 
3 import numpy as np
4 import pandas as pd
5 from pandas.util._validators import validate_bool_kwarg
6 
7 from dtoolkit.accessor.register import register_series_method
8 from dtoolkit.util._decorator import deprecated_kwargs
9 
10 
11 @register_series_method
12 @deprecated_kwargs(
13     "inplace",
14     message=(
15         "The keyword argument '{argument}' of '{func_name}' is deprecated and will "
16         "be removed in 0.0.17. (Warning added DToolKit 0.0.16)"
17     ),
18 )
19 def drop_inf(
20     s: pd.Series,
21     inf: str = "all",
22     inplace: bool = False,
23 ) -> pd.Series | None:
24     """
25     Remove ``inf`` values.
26 
27     Parameters
28     ----------
29     inf : {'all', 'pos', '+', 'neg', '-'}, default 'all'
30 
31         * 'all' : Remove ``inf`` and ``-inf``.
32         * 'pos' / '+' : Only remove ``inf``.
33         * 'neg' / '-' : Only remove ``-inf``.
34 
35     inplace : bool, default False
36         If True, do operation inplace and return None.
37 
38     Returns
39     -------
40     Series or None
41         Series with ``inf`` entries dropped from it or None if
42         ``inplace=True``.
43 
44     See Also
45     --------
46     dtoolkit.accessor.dataframe.drop_inf
47         :obj:`~pandas.DataFrame` drops rows or columns which contain ``inf``
48         values.
49 
50     Examples
51     --------
52     >>> import dtoolkit.accessor
53     >>> import pandas as pd
54     >>> import numpy as np
55     >>> s = pd.Series([1., 2., np.inf])
56     >>> s
57     0    1.0
58     1    2.0
59     2    inf
60     dtype: float64
61 
62     Drop inf values from a Series.
63 
64     >>> s.drop_inf()
65     0    1.0
66     1    2.0
67     dtype: float64
68 
69     Keep the Series with valid entries in the same variable.
70 
71     >>> s.drop_inf(inplace=True)
72     >>> s
73     0    1.0
74     1    2.0
75     dtype: float64
76     """
77 
78     inplace = validate_bool_kwarg(inplace, "inplace")
79     inf_range = get_inf_range(inf)
80     mask = s.isin(inf_range)
81     result = s[~mask]
82 
83     if not inplace:
84         return result
85 
86     s._update_inplace(result)
87 
88 
89 def get_inf_range(inf: str = "all") -> list[float]:
90     """Get inf value from string"""
91 
92     inf_range = {
93         "all": [np.inf, -np.inf],
94         "pos": [np.inf],
95         "+": [np.inf],
96         "neg": [-np.inf],
97         "-": [-np.inf],
98     }
99 
100     if inf in inf_range:
101         return inf_range[inf]
102 
103     raise ValueError(f"invalid inf option: {inf!r}")
104
```
--- 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()

```

diff --git a/dtoolkit/accessor/dataframe/drop_inf.py b/dtoolkit/accessor/dataframe/drop_inf.py
--- a/dtoolkit/accessor/dataframe/drop_inf.py
+++ b/dtoolkit/accessor/dataframe/drop_inf.py
@@ -63,6 +63,10 @@
     inplace : bool, default False
         If True, do operation inplace and return None.
 
+        .. deprecated:: 0.0.17
+            'inplace' is deprecated and will be removed in 0.0.17.
+            (Warning added DToolKit 0.0.16)
+
     Returns
     -------
     DataFrame or None
diff --git a/dtoolkit/accessor/series/drop_inf.py b/dtoolkit/accessor/series/drop_inf.py
--- a/dtoolkit/accessor/series/drop_inf.py
+++ b/dtoolkit/accessor/series/drop_inf.py
@@ -35,6 +35,10 @@
     inplace : bool, default False
         If True, do operation inplace and return None.
 
+        .. deprecated:: 0.0.17
+            'inplace' is deprecated and will be removed in 0.0.17.
+            (Warning added DToolKit 0.0.16)
+
     Returns
     -------
     Series or None

{"golden_diff": "diff --git a/dtoolkit/accessor/dataframe/drop_inf.py b/dtoolkit/accessor/dataframe/drop_inf.py\n--- a/dtoolkit/accessor/dataframe/drop_inf.py\n+++ b/dtoolkit/accessor/dataframe/drop_inf.py\n@@ -63,6 +63,10 @@\n     inplace : bool, default False\n         If True, do operation inplace and return None.\n \n+        .. deprecated:: 0.0.17\n+            'inplace' is deprecated and will be removed in 0.0.17.\n+            (Warning added DToolKit 0.0.16)\n+\n     Returns\n     -------\n     DataFrame or None\ndiff --git a/dtoolkit/accessor/series/drop_inf.py b/dtoolkit/accessor/series/drop_inf.py\n--- a/dtoolkit/accessor/series/drop_inf.py\n+++ b/dtoolkit/accessor/series/drop_inf.py\n@@ -35,6 +35,10 @@\n     inplace : bool, default False\n         If True, do operation inplace and return None.\n \n+        .. deprecated:: 0.0.17\n+            'inplace' is deprecated and will be removed in 0.0.17.\n+            (Warning added DToolKit 0.0.16)\n+\n     Returns\n     -------\n     Series or None\n", "issue": "DEP: Drop `inplace` for `drop_inf`, no more `inplace`\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- [x] closes #531\r\n- [x] whatsnew entry\r\n\r\nNo more `inplace` option.\n", "before_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nimport numpy as np\nimport pandas as pd\nfrom pandas.util._validators import validate_bool_kwarg\n\nfrom dtoolkit.accessor.dataframe import boolean  # noqa\nfrom dtoolkit.accessor.register import register_dataframe_method\nfrom dtoolkit.accessor.series.drop_inf import get_inf_range\nfrom dtoolkit.util._decorator import deprecated_kwargs\n\n\nif TYPE_CHECKING:\n    from dtoolkit._typing import IntOrStr\n\n\n@register_dataframe_method\n@deprecated_kwargs(\n    \"inplace\",\n    message=(\n        \"The keyword argument '{argument}' of '{func_name}' is deprecated and will \"\n        \"be removed in 0.0.17. (Warning added DToolKit 0.0.16)\"\n    ),\n)\ndef drop_inf(\n    df: pd.DataFrame,\n    axis: IntOrStr = 0,\n    how: str = \"any\",\n    inf: str = \"all\",\n    subset: list[str] = None,\n    inplace: bool = False,\n) -> pd.DataFrame | None:\n    \"\"\"\n    Remove ``inf`` values.\n\n    Parameters\n    ----------\n    axis : {0 or 'index', 1 or 'columns'}, default 0\n        Determine if rows or columns which contain ``inf`` values are\n        removed.\n\n        * 0, or 'index' : Drop rows which contain ``inf`` values.\n        * 1, or 'columns' : Drop columns which contain ``inf`` value.\n\n    how : {'any', 'all'}, default 'any'\n        Determine if row or column is removed from :obj:`~pandas.DataFrame`,\n        when we have at least one ``inf`` or all ``inf``.\n\n        * 'any' : If any ``inf`` values are present, drop that row or column.\n        * 'all' : If all values are ``inf``, drop that row or column.\n\n    inf : {'all', 'pos', '+', 'neg', '-'}, default 'all'\n        * 'all' : Remove ``inf`` and ``-inf``.\n        * 'pos' / '+' : Only remove ``inf``.\n        * 'neg' / '-' : Only remove ``-inf``.\n\n    subset : array-like, optional\n        Labels along other axis to consider, e.g. if you are dropping rows\n        these would be a list of columns to include.\n\n    inplace : bool, default False\n        If True, do operation inplace and return None.\n\n    Returns\n    -------\n    DataFrame or None\n        DataFrame with ``inf`` entries dropped from it or None if\n        ``inplace=True``.\n\n    See Also\n    --------\n    dtoolkit.accessor.series.drop_inf\n        :obj:`~pandas.Series` drops ``inf`` values.\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> import numpy as np\n    >>> df = pd.DataFrame({\"name\": ['Alfred', 'Batman', 'Catwoman'],\n    ...                    \"toy\": [np.inf, 'Batmobile', 'Bullwhip'],\n    ...                    \"born\": [np.inf, pd.Timestamp(\"1940-04-25\"),\n    ...                             -np.inf]})\n    >>> df\n           name        toy                 born\n    0    Alfred        inf                  inf\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    2  Catwoman   Bullwhip                 -inf\n\n    Drop the rows where at least one element is inf and -inf.\n\n    >>> df.drop_inf()\n         name        toy                 born\n    1  Batman  Batmobile  1940-04-25 00:00:00\n\n    Drop the columns where at least one element is inf and -inf.\n\n    >>> df.drop_inf(axis='columns')\n           name\n    0    Alfred\n    1    Batman\n    2  Catwoman\n\n    Drop the rows where all elements are inf and -inf.\n\n    >>> df.drop_inf(how='all')\n           name        toy                 born\n    0    Alfred        inf                  inf\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    2  Catwoman   Bullwhip                 -inf\n\n    Drop the rows where at least one element is -inf.\n\n    >>> df.drop_inf(inf='neg')\n           name        toy                 born\n    0    Alfred        inf                  inf\n    1    Batman  Batmobile  1940-04-25 00:00:00\n\n    Define in which columns to look for inf and -inf values.\n\n    >>> df.drop_inf(subset=['name', 'toy'])\n           name        toy                 born\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    2  Catwoman   Bullwhip                 -inf\n\n    Keep the DataFrame with valid entries in the same variable.\n\n    >>> df.drop_inf(inplace=True)\n    >>> df\n           name        toy                 born\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    \"\"\"\n\n    inplace = validate_bool_kwarg(inplace, \"inplace\")\n    inf_range = get_inf_range(inf)\n    axis = df._get_axis_number(axis)\n    agg_axis = 1 - axis\n\n    agg_obj = df\n    if subset is not None:\n        ax = df._get_axis(agg_axis)\n        indices = ax.get_indexer_for(subset)\n        check = indices == -1\n        if check.any():\n            raise KeyError(list(np.compress(check, subset)))\n\n        agg_obj = df.take(indices, axis=agg_axis)\n\n    mask = agg_obj.isin(inf_range).boolean(how=how, axis=agg_axis)\n    result = df.loc(axis=axis)[~mask]\n\n    if not inplace:\n        return result\n\n    df._update_inplace(result)\n", "path": "dtoolkit/accessor/dataframe/drop_inf.py"}, {"content": "from __future__ import annotations\n\nimport numpy as np\nimport pandas as pd\nfrom pandas.util._validators import validate_bool_kwarg\n\nfrom dtoolkit.accessor.register import register_series_method\nfrom dtoolkit.util._decorator import deprecated_kwargs\n\n\n@register_series_method\n@deprecated_kwargs(\n    \"inplace\",\n    message=(\n        \"The keyword argument '{argument}' of '{func_name}' is deprecated and will \"\n        \"be removed in 0.0.17. (Warning added DToolKit 0.0.16)\"\n    ),\n)\ndef drop_inf(\n    s: pd.Series,\n    inf: str = \"all\",\n    inplace: bool = False,\n) -> pd.Series | None:\n    \"\"\"\n    Remove ``inf`` values.\n\n    Parameters\n    ----------\n    inf : {'all', 'pos', '+', 'neg', '-'}, default 'all'\n\n        * 'all' : Remove ``inf`` and ``-inf``.\n        * 'pos' / '+' : Only remove ``inf``.\n        * 'neg' / '-' : Only remove ``-inf``.\n\n    inplace : bool, default False\n        If True, do operation inplace and return None.\n\n    Returns\n    -------\n    Series or None\n        Series with ``inf`` entries dropped from it or None if\n        ``inplace=True``.\n\n    See Also\n    --------\n    dtoolkit.accessor.dataframe.drop_inf\n        :obj:`~pandas.DataFrame` drops rows or columns which contain ``inf``\n        values.\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> import numpy as np\n    >>> s = pd.Series([1., 2., np.inf])\n    >>> s\n    0    1.0\n    1    2.0\n    2    inf\n    dtype: float64\n\n    Drop inf values from a Series.\n\n    >>> s.drop_inf()\n    0    1.0\n    1    2.0\n    dtype: float64\n\n    Keep the Series with valid entries in the same variable.\n\n    >>> s.drop_inf(inplace=True)\n    >>> s\n    0    1.0\n    1    2.0\n    dtype: float64\n    \"\"\"\n\n    inplace = validate_bool_kwarg(inplace, \"inplace\")\n    inf_range = get_inf_range(inf)\n    mask = s.isin(inf_range)\n    result = s[~mask]\n\n    if not inplace:\n        return result\n\n    s._update_inplace(result)\n\n\ndef get_inf_range(inf: str = \"all\") -> list[float]:\n    \"\"\"Get inf value from string\"\"\"\n\n    inf_range = {\n        \"all\": [np.inf, -np.inf],\n        \"pos\": [np.inf],\n        \"+\": [np.inf],\n        \"neg\": [-np.inf],\n        \"-\": [-np.inf],\n    }\n\n    if inf in inf_range:\n        return inf_range[inf]\n\n    raise ValueError(f\"invalid inf option: {inf!r}\")\n", "path": "dtoolkit/accessor/series/drop_inf.py"}], "after_files": [{"content": "from __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nimport numpy as np\nimport pandas as pd\nfrom pandas.util._validators import validate_bool_kwarg\n\nfrom dtoolkit.accessor.dataframe import boolean  # noqa\nfrom dtoolkit.accessor.register import register_dataframe_method\nfrom dtoolkit.accessor.series.drop_inf import get_inf_range\nfrom dtoolkit.util._decorator import deprecated_kwargs\n\n\nif TYPE_CHECKING:\n    from dtoolkit._typing import IntOrStr\n\n\n@register_dataframe_method\n@deprecated_kwargs(\n    \"inplace\",\n    message=(\n        \"The keyword argument '{argument}' of '{func_name}' is deprecated and will \"\n        \"be removed in 0.0.17. (Warning added DToolKit 0.0.16)\"\n    ),\n)\ndef drop_inf(\n    df: pd.DataFrame,\n    axis: IntOrStr = 0,\n    how: str = \"any\",\n    inf: str = \"all\",\n    subset: list[str] = None,\n    inplace: bool = False,\n) -> pd.DataFrame | None:\n    \"\"\"\n    Remove ``inf`` values.\n\n    Parameters\n    ----------\n    axis : {0 or 'index', 1 or 'columns'}, default 0\n        Determine if rows or columns which contain ``inf`` values are\n        removed.\n\n        * 0, or 'index' : Drop rows which contain ``inf`` values.\n        * 1, or 'columns' : Drop columns which contain ``inf`` value.\n\n    how : {'any', 'all'}, default 'any'\n        Determine if row or column is removed from :obj:`~pandas.DataFrame`,\n        when we have at least one ``inf`` or all ``inf``.\n\n        * 'any' : If any ``inf`` values are present, drop that row or column.\n        * 'all' : If all values are ``inf``, drop that row or column.\n\n    inf : {'all', 'pos', '+', 'neg', '-'}, default 'all'\n        * 'all' : Remove ``inf`` and ``-inf``.\n        * 'pos' / '+' : Only remove ``inf``.\n        * 'neg' / '-' : Only remove ``-inf``.\n\n    subset : array-like, optional\n        Labels along other axis to consider, e.g. if you are dropping rows\n        these would be a list of columns to include.\n\n    inplace : bool, default False\n        If True, do operation inplace and return None.\n\n        .. deprecated:: 0.0.17\n            'inplace' is deprecated and will be removed in 0.0.17.\n            (Warning added DToolKit 0.0.16)\n\n    Returns\n    -------\n    DataFrame or None\n        DataFrame with ``inf`` entries dropped from it or None if\n        ``inplace=True``.\n\n    See Also\n    --------\n    dtoolkit.accessor.series.drop_inf\n        :obj:`~pandas.Series` drops ``inf`` values.\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> import numpy as np\n    >>> df = pd.DataFrame({\"name\": ['Alfred', 'Batman', 'Catwoman'],\n    ...                    \"toy\": [np.inf, 'Batmobile', 'Bullwhip'],\n    ...                    \"born\": [np.inf, pd.Timestamp(\"1940-04-25\"),\n    ...                             -np.inf]})\n    >>> df\n           name        toy                 born\n    0    Alfred        inf                  inf\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    2  Catwoman   Bullwhip                 -inf\n\n    Drop the rows where at least one element is inf and -inf.\n\n    >>> df.drop_inf()\n         name        toy                 born\n    1  Batman  Batmobile  1940-04-25 00:00:00\n\n    Drop the columns where at least one element is inf and -inf.\n\n    >>> df.drop_inf(axis='columns')\n           name\n    0    Alfred\n    1    Batman\n    2  Catwoman\n\n    Drop the rows where all elements are inf and -inf.\n\n    >>> df.drop_inf(how='all')\n           name        toy                 born\n    0    Alfred        inf                  inf\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    2  Catwoman   Bullwhip                 -inf\n\n    Drop the rows where at least one element is -inf.\n\n    >>> df.drop_inf(inf='neg')\n           name        toy                 born\n    0    Alfred        inf                  inf\n    1    Batman  Batmobile  1940-04-25 00:00:00\n\n    Define in which columns to look for inf and -inf values.\n\n    >>> df.drop_inf(subset=['name', 'toy'])\n           name        toy                 born\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    2  Catwoman   Bullwhip                 -inf\n\n    Keep the DataFrame with valid entries in the same variable.\n\n    >>> df.drop_inf(inplace=True)\n    >>> df\n           name        toy                 born\n    1    Batman  Batmobile  1940-04-25 00:00:00\n    \"\"\"\n\n    inplace = validate_bool_kwarg(inplace, \"inplace\")\n    inf_range = get_inf_range(inf)\n    axis = df._get_axis_number(axis)\n    agg_axis = 1 - axis\n\n    agg_obj = df\n    if subset is not None:\n        ax = df._get_axis(agg_axis)\n        indices = ax.get_indexer_for(subset)\n        check = indices == -1\n        if check.any():\n            raise KeyError(list(np.compress(check, subset)))\n\n        agg_obj = df.take(indices, axis=agg_axis)\n\n    mask = agg_obj.isin(inf_range).boolean(how=how, axis=agg_axis)\n    result = df.loc(axis=axis)[~mask]\n\n    if not inplace:\n        return result\n\n    df._update_inplace(result)\n", "path": "dtoolkit/accessor/dataframe/drop_inf.py"}, {"content": "from __future__ import annotations\n\nimport numpy as np\nimport pandas as pd\nfrom pandas.util._validators import validate_bool_kwarg\n\nfrom dtoolkit.accessor.register import register_series_method\nfrom dtoolkit.util._decorator import deprecated_kwargs\n\n\n@register_series_method\n@deprecated_kwargs(\n    \"inplace\",\n    message=(\n        \"The keyword argument '{argument}' of '{func_name}' is deprecated and will \"\n        \"be removed in 0.0.17. (Warning added DToolKit 0.0.16)\"\n    ),\n)\ndef drop_inf(\n    s: pd.Series,\n    inf: str = \"all\",\n    inplace: bool = False,\n) -> pd.Series | None:\n    \"\"\"\n    Remove ``inf`` values.\n\n    Parameters\n    ----------\n    inf : {'all', 'pos', '+', 'neg', '-'}, default 'all'\n\n        * 'all' : Remove ``inf`` and ``-inf``.\n        * 'pos' / '+' : Only remove ``inf``.\n        * 'neg' / '-' : Only remove ``-inf``.\n\n    inplace : bool, default False\n        If True, do operation inplace and return None.\n\n        .. deprecated:: 0.0.17\n            'inplace' is deprecated and will be removed in 0.0.17.\n            (Warning added DToolKit 0.0.16)\n\n    Returns\n    -------\n    Series or None\n        Series with ``inf`` entries dropped from it or None if\n        ``inplace=True``.\n\n    See Also\n    --------\n    dtoolkit.accessor.dataframe.drop_inf\n        :obj:`~pandas.DataFrame` drops rows or columns which contain ``inf``\n        values.\n\n    Examples\n    --------\n    >>> import dtoolkit.accessor\n    >>> import pandas as pd\n    >>> import numpy as np\n    >>> s = pd.Series([1., 2., np.inf])\n    >>> s\n    0    1.0\n    1    2.0\n    2    inf\n    dtype: float64\n\n    Drop inf values from a Series.\n\n    >>> s.drop_inf()\n    0    1.0\n    1    2.0\n    dtype: float64\n\n    Keep the Series with valid entries in the same variable.\n\n    >>> s.drop_inf(inplace=True)\n    >>> s\n    0    1.0\n    1    2.0\n    dtype: float64\n    \"\"\"\n\n    inplace = validate_bool_kwarg(inplace, \"inplace\")\n    inf_range = get_inf_range(inf)\n    mask = s.isin(inf_range)\n    result = s[~mask]\n\n    if not inplace:\n        return result\n\n    s._update_inplace(result)\n\n\ndef get_inf_range(inf: str = \"all\") -> list[float]:\n    \"\"\"Get inf value from string\"\"\"\n\n    inf_range = {\n        \"all\": [np.inf, -np.inf],\n        \"pos\": [np.inf],\n        \"+\": [np.inf],\n        \"neg\": [-np.inf],\n        \"-\": [-np.inf],\n    }\n\n    if inf in inf_range:\n        return inf_range[inf]\n\n    raise ValueError(f\"invalid inf option: {inf!r}\")\n", "path": "dtoolkit/accessor/series/drop_inf.py"}]}