Open Alexander-Barth opened 5 years ago
Would it be useful to make a pull request adding this function?
Fixing deprecated function calls, this is what I currently use:
using PyCall
using PyCall: PyObject
# allow for plotting with missing values
function PyObject(a::Array{Union{T,Missing},N}) where {T,N}
numpy_ma = PyCall.pyimport("numpy").ma
pycall(numpy_ma.array, Any, coalesce.(a,zero(T)), mask=ismissing.(a))
end
I would like to plot (with PyPlot) an array containing missing values:
Unfortunately, I get the following error with PyCall v1.18.5, PyPlot v2.6.3 and Julia v1.0.1:
However, if declare the following convertion rule in PyCall, the plotting works:
The function
PyCall
creates essentially a numpy masked array. All missing values are replaced by zero and a mask is given to indicate which values are missing.Can this be added to PyCall?