|
28 | 28 | )
|
29 | 29 | from pandas.compat._optional import import_optional_dependency
|
30 | 30 | from pandas.util._decorators import doc
|
| 31 | +from pandas.util._exceptions import find_stack_level |
31 | 32 |
|
32 | 33 | import pandas as pd
|
33 | 34 | from pandas import (
|
@@ -310,7 +311,7 @@ def render(
|
310 | 311 | warnings.warn(
|
311 | 312 | "this method is deprecated in favour of `Styler.to_html()`",
|
312 | 313 | FutureWarning,
|
313 |
| - stacklevel=2, |
| 314 | + stacklevel=find_stack_level(), |
314 | 315 | )
|
315 | 316 | if sparse_index is None:
|
316 | 317 | sparse_index = get_option("styler.sparse.index")
|
@@ -1675,7 +1676,7 @@ def where(
|
1675 | 1676 | warnings.warn(
|
1676 | 1677 | "this method is deprecated in favour of `Styler.applymap()`",
|
1677 | 1678 | FutureWarning,
|
1678 |
| - stacklevel=2, |
| 1679 | + stacklevel=find_stack_level(), |
1679 | 1680 | )
|
1680 | 1681 |
|
1681 | 1682 | if other is None:
|
@@ -1707,7 +1708,7 @@ def set_precision(self, precision: int) -> StylerRenderer:
|
1707 | 1708 | warnings.warn(
|
1708 | 1709 | "this method is deprecated in favour of `Styler.format(precision=..)`",
|
1709 | 1710 | FutureWarning,
|
1710 |
| - stacklevel=2, |
| 1711 | + stacklevel=find_stack_level(), |
1711 | 1712 | )
|
1712 | 1713 | self.precision = precision
|
1713 | 1714 | return self.format(precision=precision, na_rep=self.na_rep)
|
@@ -2217,7 +2218,7 @@ def set_na_rep(self, na_rep: str) -> StylerRenderer:
|
2217 | 2218 | warnings.warn(
|
2218 | 2219 | "this method is deprecated in favour of `Styler.format(na_rep=..)`",
|
2219 | 2220 | FutureWarning,
|
2220 |
| - stacklevel=2, |
| 2221 | + stacklevel=find_stack_level(), |
2221 | 2222 | )
|
2222 | 2223 | self.na_rep = na_rep
|
2223 | 2224 | return self.format(na_rep=na_rep, precision=self.precision)
|
@@ -2271,7 +2272,7 @@ def hide_index(
|
2271 | 2272 | warnings.warn(
|
2272 | 2273 | "this method is deprecated in favour of `Styler.hide(axis='index')`",
|
2273 | 2274 | FutureWarning,
|
2274 |
| - stacklevel=2, |
| 2275 | + stacklevel=find_stack_level(), |
2275 | 2276 | )
|
2276 | 2277 | return self.hide(axis=0, level=level, subset=subset, names=names)
|
2277 | 2278 |
|
@@ -2324,7 +2325,7 @@ def hide_columns(
|
2324 | 2325 | warnings.warn(
|
2325 | 2326 | "this method is deprecated in favour of `Styler.hide(axis='columns')`",
|
2326 | 2327 | FutureWarning,
|
2327 |
| - stacklevel=2, |
| 2328 | + stacklevel=find_stack_level(), |
2328 | 2329 | )
|
2329 | 2330 | return self.hide(axis=1, level=level, subset=subset, names=names)
|
2330 | 2331 |
|
|
0 commit comments