Skip to content

Commit 5f62f04

Browse files
committed
Add change log for version 0.21
1 parent 78bb1bf commit 5f62f04

File tree

2 files changed

+130
-5
lines changed

2 files changed

+130
-5
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
New features
2+
------------
3+
4+
* implemented set_axes() method to replace one, several or all axes of an array (closes :issue:`67`).
5+
The method with_axes() is now deprecated (set_axes() must be used instead).
6+
7+
>>> arr = ndtest((2, 3))
8+
>>> arr
9+
a\\b | b0 | b1 | b2
10+
a0 | 0 | 1 | 2
11+
a1 | 3 | 4 | 5
12+
>>> row = Axis('row', ['r0', 'r1'])
13+
>>> column = Axis('column', ['c0', 'c1', 'c2'])
14+
Replace one axis (second argument `new_axis` must be provided)
15+
>>> arr.set_axes(x.a, row)
16+
row\\b | b0 | b1 | b2
17+
r0 | 0 | 1 | 2
18+
r1 | 3 | 4 | 5
19+
Replace several axes (keywords, list of tuple or dictionary)
20+
>>> arr.set_axes(a=row, b=column)
21+
row\\column | c0 | c1 | c2
22+
r0 | 0 | 1 | 2
23+
r1 | 3 | 4 | 5
24+
>>> arr.set_axes([(x.a, row), (x.b, column)])
25+
row\\column | c0 | c1 | c2
26+
r0 | 0 | 1 | 2
27+
r1 | 3 | 4 | 5
28+
>>> arr.set_axes({x.a: row, x.b: column})
29+
row\\column | c0 | c1 | c2
30+
r0 | 0 | 1 | 2
31+
r1 | 3 | 4 | 5
32+
Replace all axes (list of axes or AxisCollection)
33+
>>> arr.set_axes([row, column])
34+
row\\column | c0 | c1 | c2
35+
r0 | 0 | 1 | 2
36+
r1 | 3 | 4 | 5
37+
>>> arr2 = ndrange([row, column])
38+
>>> arr.set_axes(arr2.axes)
39+
row\\column | c0 | c1 | c2
40+
r0 | 0 | 1 | 2
41+
r1 | 3 | 4 | 5
42+
43+
* implemented from_string() method to create an array from a string:
44+
45+
>>> from_string('''age,nat\\sex, M, F
46+
... 0, BE, 0, 1
47+
... 0, FO, 2, 3
48+
... 1, BE, 4, 5
49+
... 1, FO, 6, 7''')
50+
age | nat\sex | M | F
51+
0 | BE | 0 | 1
52+
0 | FO | 2 | 3
53+
1 | BE | 4 | 5
54+
1 | FO | 6 | 7
55+
56+
* allowed to use a regular expression in split_axis method (closes :issue:`106`):
57+
58+
>>> combined = ndrange('a_b = a0b0..a1b2')
59+
>>> combined
60+
a_b | a0b0 | a0b1 | a0b2 | a1b0 | a1b1 | a1b2
61+
| 0 | 1 | 2 | 3 | 4 | 5
62+
>>> combined.split_axis(x.a_b, regex='(\w{2})(\w{2})')
63+
a\\b | b0 | b1 | b2
64+
a0 | 0 | 1 | 2
65+
a1 | 3 | 4 |
66+
67+
* implemented Axis.by() which is equivalent to axis[:].by()
68+
69+
>>> Axis('age', range(10)).by(3, 4)
70+
(age.i[0:3], age.i[4:7], age.i[8:10])
71+
72+
Miscellaneous improvements
73+
--------------------------
74+
75+
* added installation instructions (closes :issue:`101`).
76+
77+
* viewer : make shortcuts work even when the focus is not on the array editor widget
78+
(ie it is on the array list, or on the interactive console) (closes :issue:`102`).
79+
80+
* allowed matrix multiplication (@ operator) between arrays with dimension != 2 (closes :issue:`122`).
81+
82+
* viewer : automatically display plots done in the viewer console in a separate window
83+
(unless "%matplotlib inline" is used). Plots can be done via the array widget
84+
(using shortcut CTRL+P or right click) or from the console:
85+
86+
>>> arr = ndtest((3, 3))
87+
>>> arr.plot()
88+
89+
Now both methods generate a plot in separate window.
90+
91+
* improved LArray.plot to get nicer plots by default.
92+
The axes are transposed compared to what they used to, because the last axis is often used for time series.
93+
Also it considers a 1D array like a single series, not N series of 1 point.
94+
95+
* added possibility to tag multiple groups with an axis in one shot (backward incompatible)
96+
97+
>>> year = Axis('year', '2001 .. 2010')
98+
>>> year.group('2001,2002;2003:2008;2009,2010')
99+
[[2001, 2002], slice(2003, 2008, None), [2009, 2010]]
100+
101+
Fixes
102+
-----
103+
104+
* viewer: allow changing the number of displayed digits even for integer arrays as that makes sense when using
105+
scientific notation (closes :issue:`100`).
106+
107+
* viewer : fixed opening a viewer via view() edit() or compare() from within the viewer
108+
(closes :issue:`109`)
109+
110+
* viewer : fixed compare() colors when arrays have values which are very close but not exactly equal
111+
(closes :issue:`123`)
112+
113+
* viewer : fixed legend when plotting arbitrary rows (it always displayed the labels of the first rows)
114+
(closes :issue:`136`).
115+
116+
* fixed posargsort labels (closes :issue:`137`).

larray/core.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3947,7 +3947,7 @@ def replace_axes(self, axes_to_replace=None, new_axis=None, **kwargs):
39473947
list of tuple (axis ref, axis) or list of Axis or
39483948
AxisCollection
39493949
Axes to replace. If a single axis reference is given,
3950-
the `new_axes` argument must be used. If a list of
3950+
the `new_axis` argument must be used. If a list of
39513951
Axis or an AxisCollection is given, all axes will be
39523952
replaced by the new ones. In that case, the number of
39533953
new axes must match the number of the old ones.
@@ -3976,14 +3976,16 @@ def replace_axes(self, axes_to_replace=None, new_axis=None, **kwargs):
39763976
a1 | 3 | 4 | 5
39773977
>>> row = Axis('row', ['r0', 'r1'])
39783978
>>> column = Axis('column', ['c0', 'c1', 'c2'])
3979+
3980+
Replace one axis (expect 2 arguments)
3981+
39793982
>>> arr.replace_axes(x.a, row)
39803983
row\\b | b0 | b1 | b2
39813984
r0 | 0 | 1 | 2
39823985
r1 | 3 | 4 | 5
3983-
>>> arr.replace_axes([row, column])
3984-
row\\column | c0 | c1 | c2
3985-
r0 | 0 | 1 | 2
3986-
r1 | 3 | 4 | 5
3986+
3987+
Replace several axes (keywords, list of tuple or dictionary)
3988+
39873989
>>> arr.replace_axes(a=row, b=column)
39883990
row\\column | c0 | c1 | c2
39893991
r0 | 0 | 1 | 2
@@ -3993,6 +3995,13 @@ def replace_axes(self, axes_to_replace=None, new_axis=None, **kwargs):
39933995
r0 | 0 | 1 | 2
39943996
r1 | 3 | 4 | 5
39953997
>>> arr.replace_axes({x.a: row, x.b: column})
3998+
row\\column | c0 | c1 | c2
3999+
r0 | 0 | 1 | 2
4000+
r1 | 3 | 4 | 5
4001+
4002+
Replace all axes (list of axes or AxisCollection)
4003+
4004+
>>> arr.replace_axes([row, column])
39964005
row\\column | c0 | c1 | c2
39974006
r0 | 0 | 1 | 2
39984007
r1 | 3 | 4 | 5

0 commit comments

Comments
 (0)