Skip to content

Commit 09245fd

Browse files
KhemkaranKhemkaran
authored andcommitted
moved check to _select_data
1 parent c171633 commit 09245fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/core/methods/describe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,6 @@ def describe(self, percentiles: Sequence[float] | np.ndarray) -> DataFrame:
172172
ldesc.append(describe_func(series, percentiles))
173173

174174
col_names = reorder_columns(ldesc)
175-
if len(ldesc) == 0:
176-
raise ValueError("None of the included dtypes are present in the DataFrame")
177175
d = concat(
178176
[x.reindex(col_names) for x in ldesc],
179177
axis=1,
@@ -201,6 +199,9 @@ def _select_data(self) -> DataFrame:
201199
include=self.include,
202200
exclude=self.exclude,
203201
)
202+
if len(data.columns) == 0:
203+
msg = "None of the included dtypes are present in the DataFrame"
204+
raise ValueError(msg)
204205
return data
205206

206207

0 commit comments

Comments
 (0)