Skip to content

Commit ceffdf8

Browse files
committed
DOC: added mention and test about Axis.intersection conserving duplicate labels
1 parent 3588c64 commit ceffdf8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

larray/core/axis.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,8 +1265,8 @@ def union(self, other) -> 'Axis':
12651265
def intersection(self, other) -> 'Axis':
12661266
r"""Return axis with the (set) intersection of this axis labels and other labels.
12671267
1268-
In other words, this will use labels from this axis if they are also in other. Labels relative order will be
1269-
kept intact.
1268+
In other words, this will use labels from this axis if they are also in
1269+
other. Duplicate labels and labels relative order will be kept intact.
12701270
12711271
Parameters
12721272
----------
@@ -1290,6 +1290,8 @@ def intersection(self, other) -> 'Axis':
12901290
Axis(['a1', 'a2'], 'a')
12911291
>>> a.intersection(['a1', 'a2', 'a3'])
12921292
Axis(['a1', 'a2'], 'a')
1293+
>>> Axis('a=a0,a1,a0').intersection('a1,a0')
1294+
Axis(['a0', 'a1', 'a0'], 'a')
12931295
"""
12941296
non_string_scalar = np.isscalar(other) and not isinstance(other, str)
12951297
other = [other] if non_string_scalar else _to_ticks(other)

0 commit comments

Comments
 (0)