File tree 2 files changed +24
-1
lines changed
2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ def __getitem__(self, key):
123
123
# generally slice or list.
124
124
# TODO(ix): most/all of the TypeError cases here are for ix,
125
125
# so this check can be removed once ix is removed.
126
+ # The InvalidIndexError is only catched for compatibility
127
+ # with geopandas, see
128
+ # https://github.com/pandas-dev/pandas/issues/27258
126
129
pass
127
130
else :
128
131
if is_scalar (values ):
Original file line number Diff line number Diff line change 10
10
11
11
from pandas .compat import PY36
12
12
13
- from pandas import DataFrame
13
+ from pandas import DataFrame , Series
14
14
from pandas .util import testing as tm
15
15
16
16
@@ -123,6 +123,26 @@ def test_geopandas():
123
123
assert geopandas .read_file (fp ) is not None
124
124
125
125
126
+ def test_geopandas_coordinate_indexer ():
127
+ # this test is included to have coverage of one case in the indexing.py
128
+ # code that is only kept for compatibility with geopandas, see
129
+ # https://github.com/pandas-dev/pandas/issues/27258
130
+ # We should be able to remove this after some time when its usage is
131
+ # removed in geopandas
132
+ from pandas .core .indexing import _NDFrameIndexer
133
+
134
+ class _CoordinateIndexer (_NDFrameIndexer ):
135
+ def _getitem_tuple (self , tup ):
136
+ obj = self .obj
137
+ xs , ys = tup
138
+ return obj [xs ][ys ]
139
+
140
+ Series ._create_indexer ("cx" , _CoordinateIndexer )
141
+ s = Series (range (5 ))
142
+ res = s .cx [:, :]
143
+ tm .assert_series_equal (s , res )
144
+
145
+
126
146
# Cython import warning
127
147
@pytest .mark .filterwarnings ("ignore:can't resolve:ImportWarning" )
128
148
def test_pyarrow (df ):
You can’t perform that action at this time.
0 commit comments