Changing dtype when appending text data to carray

4 views
Skip to first unread message

m...@sellpy.se

unread,
Mar 16, 2018, 9:17:27 AM3/16/18
to bcolz
Hi,

I am trying to iteratively append columns of strings to a bcolz carray and realised bcolz sets the dtype length after the first list of strings.

e.g.

import bcolz
list_1 = ["A", "B", "C"]
bcolz_array = bcolz.carray(list_1) # sets dtype to U1
list_2 = ["AA", "BB", "CC"]
bcolz_array.append(bcolz.carray(list_2))
-> ['A' 'B' 'C' 'A' 'B' 'C'] 

Is there a way of changing the dtype on the fly when appending, or should I just set the dtype manually to some arbitrarily long dtype e.g. np.dtype("U500")?

Best,
Max
Reply all
Reply to author
Forward
0 new messages