|
30 | 30 | from collections.abc import Iterable, Sequence |
31 | 31 | import builtins |
32 | 32 | import os |
33 | | -import sys |
34 | 33 | import functools |
35 | 34 | import warnings |
36 | 35 |
|
@@ -2932,11 +2931,6 @@ def _prepare_aggregate(self, op, args, kwargs=None, commutative=False, stack_dep |
2932 | 2931 | assert isinstance(explicit_axis, AxisCollection) |
2933 | 2932 | args += tuple(explicit_axis) |
2934 | 2933 | kwargs_items = kwargs.items() |
2935 | | - if not commutative and len(kwargs_items) > 1: |
2936 | | - # TODO: lift this restriction for python3.6+ |
2937 | | - raise ValueError(f"grouping aggregates on multiple axes at the same time using keyword arguments is not " |
2938 | | - f"supported for '{op.__name__}' (because it is not a commutative operation and keyword " |
2939 | | - f"arguments are *not* ordered in Python)") |
2940 | 2934 |
|
2941 | 2935 | # Sort kwargs by axis name so that we have consistent results between runs because otherwise rounding errors |
2942 | 2936 | # could lead to slightly different results even for commutative operations. |
@@ -9312,7 +9306,7 @@ def eye(rows, columns=None, k=0, title=None, dtype=None, meta=None) -> Array: |
9312 | 9306 | # stack(('M', a1), ('F', a2), axis='sex') |
9313 | 9307 | # stack(a1, a2, axis='sex') |
9314 | 9308 |
|
9315 | | -# on Python 3.6, we could do something like (it would make from_lists obsolete for 1D arrays): |
| 9309 | +# we could do something like (it would make from_lists obsolete for 1D arrays): |
9316 | 9310 | # stack('sex', M=1, F=2) |
9317 | 9311 |
|
9318 | 9312 | # which is almost equivalent to: |
@@ -9520,10 +9514,8 @@ def stack(elements=None, axes=None, title=None, meta=None, dtype=None, res_axes= |
9520 | 9514 | M 1.0 0.0 |
9521 | 9515 | F 1.0 0.0 |
9522 | 9516 |
|
9523 | | - Without passing an explicit order for labels (or an axis object like above), it should only be used on Python 3.6 |
9524 | | - or later because keyword arguments are NOT ordered on earlier Python versions. |
| 9517 | + Without passing an explicit order for labels (or an axis object like above) |
9525 | 9518 |
|
9526 | | - >>> # use this only on Python 3.6 and later |
9527 | 9519 | >>> stack(BE=arr1, FO=arr2, axes='nat') # doctest: +SKIP |
9528 | 9520 | sex\nat BE FO |
9529 | 9521 | M 1.0 0.0 |
@@ -9583,17 +9575,9 @@ def stack(elements=None, axes=None, title=None, meta=None, dtype=None, res_axes= |
9583 | 9575 | axes = AxisCollection(axes) |
9584 | 9576 |
|
9585 | 9577 | if kwargs: |
9586 | | - if not isinstance(axes, AxisCollection) and sys.version_info[:2] < (3, 6): |
9587 | | - warnings.warn("keyword arguments ordering is not guaranteed for Python < 3.6 so it is not " |
9588 | | - "recommended to use them in stack() without providing labels order in the axes argument") |
9589 | 9578 | elements = kwargs.items() |
9590 | 9579 |
|
9591 | 9580 | if isinstance(elements, dict): |
9592 | | - if not isinstance(axes, AxisCollection) and sys.version_info[:2] < (3, 7): |
9593 | | - # stacklevel=3 because of deprecate_kwarg |
9594 | | - warnings.warn("dict ordering is not guaranteed for Python < 3.7 so it is not recommended to use " |
9595 | | - "them in stack() without providing labels order in the axes argument", stacklevel=3) |
9596 | | - |
9597 | 9581 | elements = elements.items() |
9598 | 9582 |
|
9599 | 9583 | if isinstance(elements, Array): |
|
0 commit comments