Skip to content

Commit 0259a21

Browse files
author
Christopher Doris
committed
adds ArrayValue.to_numpy()
1 parent 06ab661 commit 0259a21

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/src/juliacall-reference.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ copy of the original array.
132132
- `shape`: Tuple of lengths in each dimension.
133133
- `copy()`: A copy of the array.
134134
- `reshape(shape)`: A reshaped view of the array.
135+
- `to_numpy()`: Convert to a numpy array.
135136
`````
136137

137138
`````@customdoc

src/jlwrap/array.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@ function init_jlwrap_array()
330330
except ImportError:
331331
pass
332332
return arr
333+
def to_numpy(self, dtype=None):
334+
import numpy
335+
return numpy.array(self, dtype=dtype)
333336
""", @__FILE__(), "exec"), jl.__dict__)
334337
pycopy!(pyjlarraytype, jl.ArrayValue)
335338
end

0 commit comments

Comments
 (0)