You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It works pretty well, but I ran into the issue recently that similar(a::DataValueArray, Any) does not return an array that can hold any value, which prevents Base map and collect from working.
@JeffBezanson: do you have a little more info what you were trying to do?
The following seems to work:
using DataValues
x =DataValueArray([1,2,NA])
y =similar(x, Any)
y[1]="asdf"
y[2]=3.5
The type of y is DataValues.DataValueArray{Any,1}, and now that I think about it, maybe it should just be Array{Any,1}, right? But things shouldn't break, regardless of that specific choice.
The text was updated successfully, but these errors were encountered:
The problem is that the eltype of similar(a::DataValueArray, Any) is not Any but DataValue{Any}, so the logic in e.g. map copies the array on every iteration thinking the type is not wide enough yet.
Yeah, that is just a bug. #33 changes this so that similar only returns a DataValueArray when you pass DataValue as the desired element type. That seems more sensible. I just hope I'm not introducing some method ambiguity with this new definition... They always make me nervous. If you spot some problem there, please let me know!
@JeffBezanson reports this over at JuliaData/Missings.jl#6 (comment):
@JeffBezanson: do you have a little more info what you were trying to do?
The following seems to work:
The type of
y
isDataValues.DataValueArray{Any,1}
, and now that I think about it, maybe it should just beArray{Any,1}
, right? But things shouldn't break, regardless of that specific choice.The text was updated successfully, but these errors were encountered: