Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions bigframes/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,11 @@ def drop(
columns: Union[blocks.Label, typing.Iterable[blocks.Label]] = None,
level: typing.Optional[LevelType] = None,
) -> Series:
if labels and index:
raise ValueError("Must specify exacly one of 'labels' or 'index'")
index = labels or index
if (labels is None) == (index is None):
raise ValueError("Must specify exactly one of 'labels' or 'index'")

if labels is not None:
index = labels

# ignore axis, columns params
block = self._block
Expand Down
14 changes: 10 additions & 4 deletions tests/system/small/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,10 +1529,16 @@ def test_groupby_window_ops(scalars_df_index, scalars_pandas_df_index, operator)
)


def test_drop_label(scalars_df_index, scalars_pandas_df_index):
col_name = "int64_col"
bf_series = scalars_df_index[col_name].drop(1).to_pandas()
pd_series = scalars_pandas_df_index[col_name].drop(1)
@pytest.mark.parametrize(
("label", "col_name"),
[
(0, "bool_col"),
(1, "int64_col"),
],
)
def test_drop_label(scalars_df_index, scalars_pandas_df_index, label, col_name):
bf_series = scalars_df_index[col_name].drop(label).to_pandas()
pd_series = scalars_pandas_df_index[col_name].drop(label)
pd.testing.assert_series_equal(
pd_series,
bf_series,
Expand Down