You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is the line of code. We only create a Series if the row_label is not None, which only occurs rather than also if a slice occurs. Our return type should probably not based on whether we take a single row or a slice of rows, but based on the two-way interaction of row and column indexing. Something like:
single row + single column -> scalar
single row + multiple columns -> series
slice + single column -> series
slice + multiple columns -> dataframe
Pandas actually doesn't quite do this exclusively. They also return a dataframe for slice + list of a single column. So if the row indexer is a slice and the column indexer is a list we can return a dataframe.
They also return a series for a single row + list of single column:
type(pdf.loc[0, ['x']])
pandas.core.series.Series
So essentially, they "upcast" from scalar -> and series -> dataframe if the column indexer argument is a list for the respective row indexer (single row and slice).
Describe the bug
Single column slicing with
loc
returns a DataFrame not a Series.Steps/Code to reproduce bug
Expected behavior
I expect this to be consistent with pandas and return a Series, not a DataFrame.
Additional context
This bug partially blocks cumulative aggregation operations with dask-cudf.
The text was updated successfully, but these errors were encountered: