Skip to content

Commit

Permalink
Remove stale dataframe check
Browse files Browse the repository at this point in the history
  • Loading branch information
isVoid committed Jan 5, 2021
1 parent e0c2f2a commit 57fdd4a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions python/cudf/cudf/core/reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,18 +995,17 @@ def unstack(df, level, fill_value=None):
return df
df = df.copy(deep=False)
if not isinstance(df.index, cudf.MultiIndex):
if isinstance(df, cudf.DataFrame):
dtype = df._columns[0].dtype
for col in df._columns:
if not col.dtype == dtype:
raise ValueError(
"Calling unstack() on single index dataframe"
" with different column datatype is not supported."
)
res = df.T.stack(dropna=False)
# Result's index is a multiindex
res.index.names = tuple(df.columns.names) + df.index.names
return res
dtype = df._columns[0].dtype
for col in df._columns:
if not col.dtype == dtype:
raise ValueError(
"Calling unstack() on single index dataframe"
" with different column datatype is not supported."
)
res = df.T.stack(dropna=False)
# Result's index is a multiindex
res.index.names = tuple(df.columns.names) + df.index.names
return res
else:
columns = df.index._poplevels(level)
index = df.index
Expand Down

0 comments on commit 57fdd4a

Please sign in to comment.