|
7 | 7 | # * split unit tests
|
8 | 8 |
|
9 | 9 | # * easily add sum column for a dimension
|
| 10 | +# - in all cases, we will need to define a new Axis object |
| 11 | +# - in the examples below, we suppose a.label is 'income' |
| 12 | +# - best candidates (IMO) |
| 13 | +# - a.append(age=a.sum(age)) # label is "income.sum(age)" |
| 14 | +# # ideally, it should be just "sum(age)" |
| 15 | +# # (the label on the array stays "income" |
| 16 | +# # after all, so it is redundant to add |
| 17 | +# # it here) but that is probably harder |
| 18 | +# # to get because a.sum(age).label should |
| 19 | +# # really be "income.sum(age)", it is just |
| 20 | +# # the label/tick on the new Axis that |
| 21 | +# # should not contain "income". |
| 22 | +# - a.append(age=a.sum(age).label('total')) # label is "total" |
| 23 | +# - a.append(a.sum(age), axis=age) |
| 24 | +# - a.append_total(age) # default aggregate is sum |
| 25 | +# # default label is "total" |
| 26 | +# - a.append_total(age=avg) # default aggregate is sum, |
| 27 | +# - a.append_total(age, sex=avg) # default aggregate is sum, |
| 28 | + |
| 29 | +# other candidates |
10 | 30 | # - a.with_total(age=np.sum)
|
11 | 31 | # - a.with_total(age=np.sum,np.avg) # potentially several totals
|
12 | 32 | # - a.append(age=a.sum(age))
|
13 | 33 | # - a.append(age='sum')
|
14 | 34 | # - a.append(age=sum)
|
| 35 | + |
| 36 | +# - a.append(total=a.sum(age), axis=age) # total = the name of the new label |
15 | 37 | # - a.append(age='total=sum') # total = the name of the new label
|
16 | 38 |
|
17 | 39 | # - the following should work already (modulo the axis name -> axis num)
|
|
20 | 42 |
|
21 | 43 | # - np.append(a, a.sum(age), axis=age)
|
22 | 44 | # - a.append(a.sum(age), axis=age)
|
23 |
| -# - a.append(age=a.sum(age)) |
24 | 45 |
|
25 | 46 | # * check axes on arithmetics
|
26 | 47 | # * but special case for length 1 (to be able to do: "H + F" or "vla / belgium")
|
|
0 commit comments