Skip to content

Commit f97df66

Browse files
committed
Fix find_stack_level in get_dummies dtype warning
1 parent 45d9c79 commit f97df66

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/core/reshape/encoding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
from collections import defaultdict
4+
import inspect
45
import itertools
56
from typing import Hashable
67
import warnings
@@ -234,7 +235,7 @@ def _get_dummies_1d(
234235
"In a future version of pandas the default dtype will change from "
235236
"'uint8' to 'bool', please specify a dtype to silence this warning",
236237
FutureWarning,
237-
stacklevel=find_stack_level(),
238+
stacklevel=find_stack_level(inspect.currentframe()),
238239
)
239240
dtype = np.dtype(np.uint8)
240241
# error: Argument 1 to "dtype" has incompatible type "Union[ExtensionDtype, str,

0 commit comments

Comments
 (0)