Skip to content

Commit c1114a6

Browse files
committed
changed a few remaining occurrences of "x." to "X."
(in comments, error message and docstrings)
1 parent 8901441 commit c1114a6

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

larray/core/array.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ def _doc_agg_method(func, by=False, long_name='', action_verb='perform', extra_a
596596
* its index (integer). Index can be a negative integer, in which case it counts from the last to the
597597
first axis.
598598
* 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).
600600
* a variable (Axis). If the axis has been defined previously and assigned to a variable, you can pass it as
601601
argument.
602602
@@ -606,7 +606,7 @@ def _doc_agg_method(func, by=False, long_name='', action_verb='perform', extra_a
606606
* (['a1', 'a3', 'a5'], 'b1, b3, b5') : labels separated by commas in a list or a string
607607
* ('a1:a5:2') : select labels using a slice (general syntax is 'start:end:step' where is 'step' is
608608
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
610610
than one axis, you must precise the axis.
611611
* ('a1:a3; a5:a7', b='b0,b2; b1,b3') : create several groups with semicolons.
612612
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):
29392939
return res
29402940

29412941
# 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
29432943
# 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)
29462946
# the versions where axis is None already work as expected in the simple
29472947
# case (no ambiguous labels):
29482948
# arr.i[arr.indexofmin()]
@@ -3651,13 +3651,13 @@ def ratio(self, *axes):
36513651
# # >>> a.sum(age[[0, 1]], age[2]) / a.sum(age)
36523652
# >>> a.sum(([0, 1], 2)) / a.sum(age)
36533653
# # >>> 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)
36573657
# >>> a.ratio('F')
36583658
# could mean
36593659
# >>> 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)
36613661
# age 0 1 2
36623662
# 1.0 0.6 0.555555555556
36633663
# OR (current meaning)
@@ -3667,36 +3667,36 @@ def ratio(self, *axes):
36673667
# 1 0.666666666667 1.0
36683668
# 2 0.8 1.0
36693669
# One solution is to add an argument
3670-
# >>> a.ratio(what='F', by=x.sex)
3670+
# >>> a.ratio(what='F', by=X.sex)
36713671
# age 0 1 2
36723672
# 1.0 0.6 0.555555555556
3673-
# >>> a.sum('F') / a.sum(x.sex)
3673+
# >>> a.sum('F') / a.sum(X.sex)
36743674

36753675
# >>> a.sum((age[[0, 1]], age[[1, 2]])) / a.sum(age)
36763676
# >>> a.ratio((age[[0, 1]], age[[1, 2]]), by=age)
36773677

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)
36803680

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)
36833683

36843684
# >>> b = a.sum((age[[0, 1]], age[[1, 2]]))
36853685
# >>> b
36863686
# age\sex M F
36873687
# [0 1] 2 4
36883688
# [1 2] 6 8
3689-
# >>> b / b.sum(x.age)
3689+
# >>> b / b.sum(X.age)
36903690
# age\\sex M F
36913691
# [0 1] 0.25 0.333333333333
36923692
# [1 2] 0.75 0.666666666667
3693-
# >>> b / a.sum(x.age)
3693+
# >>> b / a.sum(X.age)
36943694
# age\\sex M F
36953695
# [0 1] 0.333333333333 0.444444444444
36963696
# [1 2] 1.0 0.888888888889
36973697
# # >>> 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]))
37003700
# nat\\sex M F
37013701
# BE 0.0 1.0
37023702
# FO 0.6666666666 1.0
@@ -7373,7 +7373,7 @@ def roll(self, axis=None, n=1):
73737373
return self[axis.i[(seq - n) % len(axis)]]
73747374

73757375
# 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)
73777377
def diff(self, axis=-1, d=1, n=1, label='upper'):
73787378
"""Calculates the n-th order discrete difference along a given axis.
73797379

larray/core/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ def retarget_to(self, target_axis):
840840
axis_name = self.axis.name if isinstance(self.axis, ABCAxisReference) else self.axis
841841
if axis_name != target_axis.name:
842842
raise ValueError('cannot retarget a Group defined without a real axis object (e.g. using '
843-
'an AxisReference (x.)) to an axis with a different name')
843+
'an AxisReference (X.)) to an axis with a different name')
844844
return self.__class__(self.key, self.name, target_axis)
845845
elif isinstance(self.axis, int) or self.axis.equals(target_axis):
846846
# in the case of isinstance(self.axis, int), we can only hope the axis corresponds. This is the

larray/tests/test_array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ def test_group_agg_on_bool_array():
20732073
assert_array_equal(b.sum('b1:'), expected)
20742074

20752075

2076-
# TODO: fix this (and add other tests for references (x.) to anonymous axes
2076+
# TODO: fix this (and add other tests for references (X.) to anonymous axes
20772077
# def test_group_agg_anonymous_axis_ref():
20782078
# la = ndtest([Axis(2), Axis(3)])
20792079
# raw = np.asarray(la)

0 commit comments

Comments
 (0)