Type conversion of `masked_array` in `numpy.ma`
- Lenguaje dominante
- Julia
- Estrellas
- 1.5k
- Forks
- 186
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
Also described in my question in StackOverflow: [How to create a masked array using numpy.ma imported by PyCall in Julia](http://stackoverflow.com/questions/35709042/how-to-create-a-masked-array-using-numpy-ma-imported-by-pycall-in-julia/35710432#35710432)
I was trying to create a `masked_array` Python object with `numpy.ma`.
``` julia
using PyCall
@pyimport numpy.ma as ma
x = ma.masked_equal([0, 1, 0, 2, 3], 0)
ma.is_masked(x)
```
The output, however, is just a Julia array.
```julia
julia> x = ma.masked_equal([0, 1, 0, 2, 3], 0)
5-element Array{Int64,1}:
0
1
0
2
3
julia> ma.is_masked(x)
false
```
The correct output can be obtained by using `pycall()` (thank Matt B. for pointing it out in my stackoverflow question):
```julia
julia> x = pycall(ma.masked_equal, Any, [0,1,0,2,3], 0)
PyObject masked_array(data = [-- 1 -- 2 3],
mask = [ True False True False False],
fill_value = 0)
julia> ma.is_masked(x)
true
```
It happens because PyCall considers the `masked_array` as just a usual array.
```julia
julia> pytype_query(x)
Array{Int64,N}
```
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.