I have a pandas Dataframe containing 1 columns which contains a string of bits eg.'100100101'
. i want to convert this string into an numpy array.
How can I do that?
EDIT:
Using
features = df.bit.apply(lambda x: np.array(list(map(int,list(x)))))
#...
model.fit(features, lables)
leads to an error on model.fit
:
ValueError: setting an array element with a sequence.
The Solution that works for my case i came up with due to marked answer:
for bitString in input_table['Bitstring'].values:
bits = np.array(map(int, list(bitString)))
featureList.append(bits)
features = np.array(featureList)
#....
model.fit(features, lables)