@@ -596,7 +596,7 @@ def _doc_agg_method(func, by=False, long_name='', action_verb='perform', extra_a
596
596
* its index (integer). Index can be a negative integer, in which case it counts from the last to the
597
597
first axis.
598
598
* its name (str or AxisReference). You can use either a simple string ('axis_name') or the special
599
- variable x (x .axis_name).
599
+ variable X (X .axis_name).
600
600
* a variable (Axis). If the axis has been defined previously and assigned to a variable, you can pass it as
601
601
argument.
602
602
@@ -606,7 +606,7 @@ def _doc_agg_method(func, by=False, long_name='', action_verb='perform', extra_a
606
606
* (['a1', 'a3', 'a5'], 'b1, b3, b5') : labels separated by commas in a list or a string
607
607
* ('a1:a5:2') : select labels using a slice (general syntax is 'start:end:step' where is 'step' is
608
608
optional and 1 by default).
609
- * (a='a1, a2, a3', x .b['b1, b2, b3']) : in case of possible ambiguity, i.e. if labels can belong to more
609
+ * (a='a1, a2, a3', X .b['b1, b2, b3']) : in case of possible ambiguity, i.e. if labels can belong to more
610
610
than one axis, you must precise the axis.
611
611
* ('a1:a3; a5:a7', b='b0,b2; b1,b3') : create several groups with semicolons.
612
612
Names are simply given by the concatenation of labels (here: 'a1,a2,a3', 'a5,a6,a7', 'b0,b2' and 'b1,b3')
@@ -2939,10 +2939,10 @@ def with_total(self, *args, **kwargs):
2939
2939
return res
2940
2940
2941
2941
# TODO: make sure we can do
2942
- # arr[x .sex.i[arr.indexofmin(x .sex)]] <- fails
2942
+ # arr[X .sex.i[arr.indexofmin(X .sex)]] <- fails
2943
2943
# and
2944
- # arr[arr.labelofmin(x .sex)] <- fails
2945
- # should both be equal to arr.min(x .sex)
2944
+ # arr[arr.labelofmin(X .sex)] <- fails
2945
+ # should both be equal to arr.min(X .sex)
2946
2946
# the versions where axis is None already work as expected in the simple
2947
2947
# case (no ambiguous labels):
2948
2948
# arr.i[arr.indexofmin()]
@@ -3651,13 +3651,13 @@ def ratio(self, *axes):
3651
3651
# # >>> a.sum(age[[0, 1]], age[2]) / a.sum(age)
3652
3652
# >>> a.sum(([0, 1], 2)) / a.sum(age)
3653
3653
# # >>> a / a.sum(([0, 1], 2))
3654
- # >>> a.sum(x .sex)
3655
- # >>> a.sum(x .age)
3656
- # >>> a.sum(x .sex) / a.sum(x .age)
3654
+ # >>> a.sum(X .sex)
3655
+ # >>> a.sum(X .age)
3656
+ # >>> a.sum(X .sex) / a.sum(X .age)
3657
3657
# >>> a.ratio('F')
3658
3658
# could mean
3659
3659
# >>> a.sum('F') / a.sum(a.get_axis('F'))
3660
- # >>> a.sum('F') / a.sum(x .sex)
3660
+ # >>> a.sum('F') / a.sum(X .sex)
3661
3661
# age 0 1 2
3662
3662
# 1.0 0.6 0.555555555556
3663
3663
# OR (current meaning)
@@ -3667,36 +3667,36 @@ def ratio(self, *axes):
3667
3667
# 1 0.666666666667 1.0
3668
3668
# 2 0.8 1.0
3669
3669
# One solution is to add an argument
3670
- # >>> a.ratio(what='F', by=x .sex)
3670
+ # >>> a.ratio(what='F', by=X .sex)
3671
3671
# age 0 1 2
3672
3672
# 1.0 0.6 0.555555555556
3673
- # >>> a.sum('F') / a.sum(x .sex)
3673
+ # >>> a.sum('F') / a.sum(X .sex)
3674
3674
3675
3675
# >>> a.sum((age[[0, 1]], age[[1, 2]])) / a.sum(age)
3676
3676
# >>> a.ratio((age[[0, 1]], age[[1, 2]]), by=age)
3677
3677
3678
- # >>> a.sum((x .age[[0, 1]], x .age[[1, 2]])) / a.sum(x .age)
3679
- # >>> a.ratio((x .age[[0, 1]], x .age[[1, 2]], by=x .age)
3678
+ # >>> a.sum((X .age[[0, 1]], X .age[[1, 2]])) / a.sum(X .age)
3679
+ # >>> a.ratio((X .age[[0, 1]], X .age[[1, 2]], by=X .age)
3680
3680
3681
- # >>> lalala.sum(([0, 1], [1, 2])) / lalala.sum(x .age)
3682
- # >>> lalala.ratio(([0, 1], [1, 2]), by=x .age)
3681
+ # >>> lalala.sum(([0, 1], [1, 2])) / lalala.sum(X .age)
3682
+ # >>> lalala.ratio(([0, 1], [1, 2]), by=X .age)
3683
3683
3684
3684
# >>> b = a.sum((age[[0, 1]], age[[1, 2]]))
3685
3685
# >>> b
3686
3686
# age\sex M F
3687
3687
# [0 1] 2 4
3688
3688
# [1 2] 6 8
3689
- # >>> b / b.sum(x .age)
3689
+ # >>> b / b.sum(X .age)
3690
3690
# age\\sex M F
3691
3691
# [0 1] 0.25 0.333333333333
3692
3692
# [1 2] 0.75 0.666666666667
3693
- # >>> b / a.sum(x .age)
3693
+ # >>> b / a.sum(X .age)
3694
3694
# age\\sex M F
3695
3695
# [0 1] 0.333333333333 0.444444444444
3696
3696
# [1 2] 1.0 0.888888888889
3697
3697
# # >>> a.ratio([0, 1], [2])
3698
- # # >>> a.ratio(x .age[[0, 1]], x .age[2])
3699
- # >>> a.ratio((x .age[[0, 1]], x .age[2]))
3698
+ # # >>> a.ratio(X .age[[0, 1]], X .age[2])
3699
+ # >>> a.ratio((X .age[[0, 1]], X .age[2]))
3700
3700
# nat\\sex M F
3701
3701
# BE 0.0 1.0
3702
3702
# FO 0.6666666666 1.0
@@ -7373,7 +7373,7 @@ def roll(self, axis=None, n=1):
7373
7373
return self [axis .i [(seq - n ) % len (axis )]]
7374
7374
7375
7375
# TODO: add support for groups as axis (like aggregates)
7376
- # eg a.diff(x .year[2018:]) instead of a[2018:].diff(x .year)
7376
+ # eg a.diff(X .year[2018:]) instead of a[2018:].diff(X .year)
7377
7377
def diff (self , axis = - 1 , d = 1 , n = 1 , label = 'upper' ):
7378
7378
"""Calculates the n-th order discrete difference along a given axis.
7379
7379
0 commit comments