Skip to content

Commit 3f6a02c

Browse files
committed
>> updated median[_by]() and var[_by]()
1 parent 8e6759d commit 3f6a02c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

larray/core/array.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4686,7 +4686,7 @@ def mean_by(self, *args, **kwargs):
46864686

46874687
@_decorate_agg_method(np.median, np.nanmedian, commutative=True)
46884688
def median(self, *args, **kwargs):
4689-
"""{signature}
4689+
r"""{signature}
46904690
46914691
Computes the arithmetic median.
46924692
@@ -4705,12 +4705,12 @@ def median(self, *args, **kwargs):
47054705
Examples
47064706
--------
47074707
>>> arr = ndtest((4, 4))
4708-
>>> arr[:,:] = [[10, 7, 5, 9], \
4709-
[5, 8, 3, 7], \
4710-
[6, 2, 0, 9], \
4711-
[9, 10, 5, 6]]
4708+
>>> arr[:,:] = [[10, 7, 5, 9],
4709+
... [5, 8, 3, 7],
4710+
... [6, 2, 0, 9],
4711+
... [9, 10, 5, 6]]
47124712
>>> arr
4713-
a\\b b0 b1 b2 b3
4713+
a\b b0 b1 b2 b3
47144714
a0 10 7 5 9
47154715
a1 5 8 3 7
47164716
a2 6 2 0 9
@@ -4737,7 +4737,7 @@ def median(self, *args, **kwargs):
47374737
Split an axis in several parts
47384738
47394739
>>> arr.median((['a0', 'a1'], ['a2', 'a3']))
4740-
a\\b b0 b1 b2 b3
4740+
a\b b0 b1 b2 b3
47414741
a0,a1 7.5 7.5 4.0 8.0
47424742
a2,a3 7.5 6.0 2.5 7.5
47434743
>>> # or equivalently
@@ -4746,7 +4746,7 @@ def median(self, *args, **kwargs):
47464746
Same with renaming
47474747
47484748
>>> arr.median((X.a['a0', 'a1'] >> 'a01', X.a['a2', 'a3'] >> 'a23'))
4749-
a\\b b0 b1 b2 b3
4749+
a\b b0 b1 b2 b3
47504750
a01 7.5 7.5 4.0 8.0
47514751
a23 7.5 6.0 2.5 7.5
47524752
>>> # or equivalently
@@ -4756,7 +4756,7 @@ def median(self, *args, **kwargs):
47564756

47574757
@_decorate_agg_method(np.median, np.nanmedian, commutative=True, by_agg=True, long_name="mediane")
47584758
def median_by(self, *args, **kwargs):
4759-
"""{signature}
4759+
r"""{signature}
47604760
47614761
Computes the arithmetic median.
47624762
@@ -4775,12 +4775,12 @@ def median_by(self, *args, **kwargs):
47754775
Examples
47764776
--------
47774777
>>> arr = ndtest((4, 4))
4778-
>>> arr[:,:] = [[10, 7, 5, 9], \
4779-
[5, 8, 3, 7], \
4780-
[6, 2, 0, 9], \
4781-
[9, 10, 5, 6]]
4778+
>>> arr[:,:] = [[10, 7, 5, 9],
4779+
... [5, 8, 3, 7],
4780+
... [6, 2, 0, 9],
4781+
... [9, 10, 5, 6]]
47824782
>>> arr
4783-
a\\b b0 b1 b2 b3
4783+
a\b b0 b1 b2 b3
47844784
a0 10 7 5 9
47854785
a1 5 8 3 7
47864786
a2 6 2 0 9
@@ -5066,7 +5066,7 @@ def ptp(self, *args, **kwargs):
50665066

50675067
@_decorate_agg_method(np.var, np.nanvar, extra_kwargs=['dtype', 'ddof'], long_name="variance")
50685068
def var(self, *args, **kwargs):
5069-
"""{signature}
5069+
r"""{signature}
50705070
50715071
Computes the unbiased variance.
50725072
@@ -5087,10 +5087,10 @@ def var(self, *args, **kwargs):
50875087
Examples
50885088
--------
50895089
>>> arr = ndtest((2, 8), dtype=float)
5090-
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3], \
5091-
[7, 3, 2, 5, 8, 5, 6, 4]]
5090+
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3],
5091+
... [7, 3, 2, 5, 8, 5, 6, 4]]
50925092
>>> arr
5093-
a\\b b0 b1 b2 b3 b4 b5 b6 b7
5093+
a\b b0 b1 b2 b3 b4 b5 b6 b7
50945094
a0 0.0 3.0 5.0 6.0 4.0 2.0 1.0 3.0
50955095
a1 7.0 3.0 2.0 5.0 8.0 5.0 6.0 4.0
50965096
>>> arr.var()
@@ -5111,7 +5111,7 @@ def var(self, *args, **kwargs):
51115111
Split an axis in several parts
51125112
51135113
>>> arr.var((['b0', 'b1', 'b3'], 'b5:'))
5114-
a\\b b0,b1,b3 b5:
5114+
a\b b0,b1,b3 b5:
51155115
a0 9.0 1.0
51165116
a1 4.0 1.0
51175117
>>> # or equivalently
@@ -5120,7 +5120,7 @@ def var(self, *args, **kwargs):
51205120
Same with renaming
51215121
51225122
>>> arr.var((X.b['b0', 'b1', 'b3'] >> 'b013', X.b['b5:'] >> 'b567'))
5123-
a\\b b013 b567
5123+
a\b b013 b567
51245124
a0 9.0 1.0
51255125
a1 4.0 1.0
51265126
>>> # or equivalently
@@ -5130,7 +5130,7 @@ def var(self, *args, **kwargs):
51305130

51315131
@_decorate_agg_method(np.var, np.nanvar, by_agg=True, extra_kwargs=['dtype', 'ddof'], long_name="variance")
51325132
def var_by(self, *args, **kwargs):
5133-
"""{signature}
5133+
r"""{signature}
51345134
51355135
Computes the unbiased variance.
51365136
@@ -5151,10 +5151,10 @@ def var_by(self, *args, **kwargs):
51515151
Examples
51525152
--------
51535153
>>> arr = ndtest((2, 8), dtype=float)
5154-
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3], \
5155-
[7, 3, 2, 5, 8, 5, 6, 4]]
5154+
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3],
5155+
... [7, 3, 2, 5, 8, 5, 6, 4]]
51565156
>>> arr
5157-
a\\b b0 b1 b2 b3 b4 b5 b6 b7
5157+
a\b b0 b1 b2 b3 b4 b5 b6 b7
51585158
a0 0.0 3.0 5.0 6.0 4.0 2.0 1.0 3.0
51595159
a1 7.0 3.0 2.0 5.0 8.0 5.0 6.0 4.0
51605160
>>> arr.var_by()
@@ -5175,7 +5175,7 @@ def var_by(self, *args, **kwargs):
51755175
Split an axis in several parts
51765176
51775177
>>> arr.var_by('a', (['b0', 'b1', 'b3'], 'b5:'))
5178-
a\\b b0,b1,b3 b5:
5178+
a\b b0,b1,b3 b5:
51795179
a0 9.0 1.0
51805180
a1 4.0 1.0
51815181
>>> # or equivalently
@@ -5184,7 +5184,7 @@ def var_by(self, *args, **kwargs):
51845184
Same with renaming
51855185
51865186
>>> arr.var_by('a', (X.b['b0', 'b1', 'b3'] >> 'b013', X.b['b5:'] >> 'b567'))
5187-
a\\b b013 b567
5187+
a\b b013 b567
51885188
a0 9.0 1.0
51895189
a1 4.0 1.0
51905190
>>> # or equivalently

0 commit comments

Comments
 (0)