import
numpy as geek
in_arr
=
geek.array([(
1.0
,
2
), (
3.0
,
-
4
), (
5.0
,
6
),
(
7.0
,
8
), (
9.0
,
-
4
), (
11.0
,
-
2
)],
dtype
=
[(
'a'
,
float
), (
'b'
,
int
)])
print
(
"Input array : "
, in_arr)
rec_arr
=
in_arr.view(geek.recarray)
print
(
"Record array of float: "
, rec_arr.a)
print
(
"Record array of int: "
, rec_arr.b)
rec_arr.a.put( [
0
,
2
], [
-
14
,
15
])
print
(
"Output float array in default mode : "
, rec_arr.a)
rec_arr.a.put(
13
,
-
4
, mode
=
'clip'
)
print
(
"Output float array in clip mode : "
, rec_arr.a)
rec_arr.b.put([
1
,
2
,
4
], [
10
,
15
,
20
])
print
(
"Output int array in default mode : "
, rec_arr.b)
rec_arr.b.put(
8
,
100
, mode
=
'clip'
)
print
(
"Output int array in clip mode : "
, rec_arr.b)