Skip to content

Commit a194cd8

Browse files
setting dtype instead of asserting warnings in most tests
1 parent 40f4253 commit a194cd8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pandas/core/groupby/generic.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1182,9 +1182,17 @@ def first_not_none(values):
11821182
if v is None:
11831183
return DataFrame()
11841184
elif isinstance(v, NDFrame):
1185+
1186+
# this is to silence a FutureWarning
1187+
# TODO: Remove when default dtype of empty Series is object
1188+
kwargs = v._construct_axes_dict()
1189+
if v._constructor is Series:
1190+
is_empty = "data" not in kwargs or not kwargs["data"]
1191+
if "dtype" not in kwargs and is_empty:
1192+
kwargs["dtype"] = object
1193+
11851194
values = [
1186-
x if x is not None else v._constructor(**v._construct_axes_dict())
1187-
for x in values
1195+
x if (x is not None) else v._constructor(**kwargs) for x in values
11881196
]
11891197

11901198
v = values[0]

0 commit comments

Comments
 (0)