Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,7 @@ jobs:
pytest pandas/tests/groupby/
pytest pandas/tests/resample/
pytest pandas/tests/reshape/merge

pytest pandas/tests/series/methods
pytest pandas/tests/series/test_*
pytest pandas/tests/series/

# indexing subset (temporary since other tests don't pass yet)
pytest pandas/tests/frame/indexing/test_indexing.py::TestDataFrameIndexing::test_setitem_boolean
Expand Down
8 changes: 7 additions & 1 deletion pandas/core/internals/array_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,13 @@ def __init__(
def _verify_integrity(self) -> None:
(n_rows,) = self.shape
assert len(self.arrays) == 1
assert len(self.arrays[0]) == n_rows
arr = self.arrays[0]
assert len(arr) == n_rows
if not arr.ndim == 1:
raise ValueError(
"Passed array should be 1-dimensional, got array with "
f"{arr.ndim} dimensions instead."
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you share any of this with the parent classes' _verify_integrity?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, I think. The parent version assumes the object is 2D, so won't work for SingleArrayManager.
I assume that the part of _verify_integrity that checks the individual array could be factored out into a shared helper function, but I would rather leave that for a follow-up.


@staticmethod
def _normalize_axis(axis):
Expand Down
12 changes: 8 additions & 4 deletions pandas/tests/series/indexing/test_getitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,12 @@ def test_getitem_partial_str_slice_high_reso_with_timedeltaindex(self):
result = ser["1 days, 10:11:12.001001"]
assert result == ser.iloc[1001]

def test_getitem_slice_2d(self, datetime_series):
def test_getitem_slice_2d(self, datetime_series, using_array_manager):
# GH#30588 multi-dimensional indexing deprecated

with tm.assert_produces_warning(FutureWarning):
with tm.assert_produces_warning(
FutureWarning, check_stacklevel=not using_array_manager
):
# GH#30867 Don't want to support this long-term, but
# for now ensure that the warning from Index
# doesn't comes through via Series.__getitem__.
Expand Down Expand Up @@ -518,9 +520,11 @@ def test_getitem_generator(string_series):
Series(date_range("2012-01-01", periods=2, tz="CET")),
],
)
def test_getitem_ndim_deprecated(series):
def test_getitem_ndim_deprecated(series, using_array_manager):
with tm.assert_produces_warning(
FutureWarning, match="Support for multi-dimensional indexing"
FutureWarning,
match="Support for multi-dimensional indexing",
check_stacklevel=not using_array_manager,
):
result = series[:, None]

Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/indexing/test_setitem.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ def test_dt64tz_setitem_does_not_mutate_dti(self):
ser = Series(dti)
assert ser._values is not dti
assert ser._values._data.base is not dti._data._data.base
assert ser._mgr.blocks[0].values is not dti
assert ser._mgr.blocks[0].values._data.base is not dti._data._data.base
assert ser._mgr.arrays[0] is not dti
assert ser._mgr.arrays[0]._data.base is not dti._data._data.base

ser[::3] = NaT
assert ser[0] is NaT
Expand Down
5 changes: 5 additions & 0 deletions pandas/tests/series/indexing/test_where.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas.core.dtypes.common import is_integer

import pandas as pd
Expand Down Expand Up @@ -471,6 +473,9 @@ def test_where_categorical(klass):
tm.assert_equal(exp, res)


# TODO(ArrayManager) DataFrame.values not yet correctly returning datetime array
# for categorical with datetime categories
@td.skip_array_manager_not_yet_implemented
def test_where_datetimelike_categorical(tz_naive_fixture):
# GH#37682
tz = tz_naive_fixture
Expand Down