Skip to content

Commit 3d7cea6

Browse files
committed
>> updated median[_by]() and var[_by]()
1 parent 3014671 commit 3d7cea6

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
@@ -4248,7 +4248,7 @@ def mean_by(self, *args, **kwargs):
42484248

42494249
@_decorate_agg_method(np.median, np.nanmedian, commutative=True)
42504250
def median(self, *args, **kwargs):
4251-
"""{signature}
4251+
r"""{signature}
42524252
42534253
Computes the arithmetic median.
42544254
@@ -4267,12 +4267,12 @@ def median(self, *args, **kwargs):
42674267
Examples
42684268
--------
42694269
>>> arr = ndtest((4, 4))
4270-
>>> arr[:,:] = [[10, 7, 5, 9], \
4271-
[5, 8, 3, 7], \
4272-
[6, 2, 0, 9], \
4273-
[9, 10, 5, 6]]
4270+
>>> arr[:,:] = [[10, 7, 5, 9],
4271+
... [5, 8, 3, 7],
4272+
... [6, 2, 0, 9],
4273+
... [9, 10, 5, 6]]
42744274
>>> arr
4275-
a\\b b0 b1 b2 b3
4275+
a\b b0 b1 b2 b3
42764276
a0 10 7 5 9
42774277
a1 5 8 3 7
42784278
a2 6 2 0 9
@@ -4299,7 +4299,7 @@ def median(self, *args, **kwargs):
42994299
Split an axis in several parts
43004300
43014301
>>> arr.median((['a0', 'a1'], ['a2', 'a3']))
4302-
a\\b b0 b1 b2 b3
4302+
a\b b0 b1 b2 b3
43034303
a0,a1 7.5 7.5 4.0 8.0
43044304
a2,a3 7.5 6.0 2.5 7.5
43054305
>>> # or equivalently
@@ -4308,7 +4308,7 @@ def median(self, *args, **kwargs):
43084308
Same with renaming
43094309
43104310
>>> arr.median((X.a['a0', 'a1'] >> 'a01', X.a['a2', 'a3'] >> 'a23'))
4311-
a\\b b0 b1 b2 b3
4311+
a\b b0 b1 b2 b3
43124312
a01 7.5 7.5 4.0 8.0
43134313
a23 7.5 6.0 2.5 7.5
43144314
>>> # or equivalently
@@ -4318,7 +4318,7 @@ def median(self, *args, **kwargs):
43184318

43194319
@_decorate_agg_method(np.median, np.nanmedian, commutative=True, by_agg=True, long_name="mediane")
43204320
def median_by(self, *args, **kwargs):
4321-
"""{signature}
4321+
r"""{signature}
43224322
43234323
Computes the arithmetic median.
43244324
@@ -4337,12 +4337,12 @@ def median_by(self, *args, **kwargs):
43374337
Examples
43384338
--------
43394339
>>> arr = ndtest((4, 4))
4340-
>>> arr[:,:] = [[10, 7, 5, 9], \
4341-
[5, 8, 3, 7], \
4342-
[6, 2, 0, 9], \
4343-
[9, 10, 5, 6]]
4340+
>>> arr[:,:] = [[10, 7, 5, 9],
4341+
... [5, 8, 3, 7],
4342+
... [6, 2, 0, 9],
4343+
... [9, 10, 5, 6]]
43444344
>>> arr
4345-
a\\b b0 b1 b2 b3
4345+
a\b b0 b1 b2 b3
43464346
a0 10 7 5 9
43474347
a1 5 8 3 7
43484348
a2 6 2 0 9
@@ -4628,7 +4628,7 @@ def ptp(self, *args, **kwargs):
46284628

46294629
@_decorate_agg_method(np.var, np.nanvar, extra_kwargs=['dtype', 'ddof'], long_name="variance")
46304630
def var(self, *args, **kwargs):
4631-
"""{signature}
4631+
r"""{signature}
46324632
46334633
Computes the unbiased variance.
46344634
@@ -4649,10 +4649,10 @@ def var(self, *args, **kwargs):
46494649
Examples
46504650
--------
46514651
>>> arr = ndtest((2, 8), dtype=float)
4652-
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3], \
4653-
[7, 3, 2, 5, 8, 5, 6, 4]]
4652+
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3],
4653+
... [7, 3, 2, 5, 8, 5, 6, 4]]
46544654
>>> arr
4655-
a\\b b0 b1 b2 b3 b4 b5 b6 b7
4655+
a\b b0 b1 b2 b3 b4 b5 b6 b7
46564656
a0 0.0 3.0 5.0 6.0 4.0 2.0 1.0 3.0
46574657
a1 7.0 3.0 2.0 5.0 8.0 5.0 6.0 4.0
46584658
>>> arr.var()
@@ -4673,7 +4673,7 @@ def var(self, *args, **kwargs):
46734673
Split an axis in several parts
46744674
46754675
>>> arr.var((['b0', 'b1', 'b3'], 'b5:'))
4676-
a\\b b0,b1,b3 b5:
4676+
a\b b0,b1,b3 b5:
46774677
a0 9.0 1.0
46784678
a1 4.0 1.0
46794679
>>> # or equivalently
@@ -4682,7 +4682,7 @@ def var(self, *args, **kwargs):
46824682
Same with renaming
46834683
46844684
>>> arr.var((X.b['b0', 'b1', 'b3'] >> 'b013', X.b['b5:'] >> 'b567'))
4685-
a\\b b013 b567
4685+
a\b b013 b567
46864686
a0 9.0 1.0
46874687
a1 4.0 1.0
46884688
>>> # or equivalently
@@ -4692,7 +4692,7 @@ def var(self, *args, **kwargs):
46924692

46934693
@_decorate_agg_method(np.var, np.nanvar, by_agg=True, extra_kwargs=['dtype', 'ddof'], long_name="variance")
46944694
def var_by(self, *args, **kwargs):
4695-
"""{signature}
4695+
r"""{signature}
46964696
46974697
Computes the unbiased variance.
46984698
@@ -4713,10 +4713,10 @@ def var_by(self, *args, **kwargs):
47134713
Examples
47144714
--------
47154715
>>> arr = ndtest((2, 8), dtype=float)
4716-
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3], \
4717-
[7, 3, 2, 5, 8, 5, 6, 4]]
4716+
>>> arr[:,:] = [[0, 3, 5, 6, 4, 2, 1, 3],
4717+
... [7, 3, 2, 5, 8, 5, 6, 4]]
47184718
>>> arr
4719-
a\\b b0 b1 b2 b3 b4 b5 b6 b7
4719+
a\b b0 b1 b2 b3 b4 b5 b6 b7
47204720
a0 0.0 3.0 5.0 6.0 4.0 2.0 1.0 3.0
47214721
a1 7.0 3.0 2.0 5.0 8.0 5.0 6.0 4.0
47224722
>>> arr.var_by()
@@ -4737,7 +4737,7 @@ def var_by(self, *args, **kwargs):
47374737
Split an axis in several parts
47384738
47394739
>>> arr.var_by('a', (['b0', 'b1', 'b3'], 'b5:'))
4740-
a\\b b0,b1,b3 b5:
4740+
a\b b0,b1,b3 b5:
47414741
a0 9.0 1.0
47424742
a1 4.0 1.0
47434743
>>> # or equivalently
@@ -4746,7 +4746,7 @@ def var_by(self, *args, **kwargs):
47464746
Same with renaming
47474747
47484748
>>> arr.var_by('a', (X.b['b0', 'b1', 'b3'] >> 'b013', X.b['b5:'] >> 'b567'))
4749-
a\\b b013 b567
4749+
a\b b013 b567
47504750
a0 9.0 1.0
47514751
a1 4.0 1.0
47524752
>>> # or equivalently

0 commit comments

Comments
 (0)