更改池化DataArray的级别

时间:2015-06-16 14:16:43

标签: julia

我正在寻找一种修改DataArray级别的方法:

result = pool(["a", "a", "b"])
levels(result) = ["A", "B"]

1 个答案:

答案 0 :(得分:1)

作为一种快速而肮脏的解决方案,您可以更改对象的pool字段 - 它恰好是可变的。

result.pool = [ "A", "B" ]

result
# 3-element PooledDataArray{ASCIIString,Uint8,1}:
# "A"
# "A"
# "B"

xdump( result )
# PooledDataArray{ASCIIString,Uint8,1} 
#   refs: Array(Uint8,(3,)) Uint8[0x01,0x01,0x02]
#   pool: Array(ASCIIString,(2,)) ASCIIString["a","b"]