怎样把字符串转化成ndarray型的数据

我生成了一个计算式,想用matplotlib画出图像,但是我的计算式是str型的,就画不了,有没有什么办法可以将str转化成ndarray啊
我开始想先将str转化成byte再转化成ndarray,但是失败了

img

img

img

###################################################################
hanshu=['+','-','*','/','^']
x=random.choice (hanshu)
y3 = roll(x,3)
print(type(y3),y3)#生成y3
#################################################################
y3='sag'
y4=y3.encode('utf8')#str转byte
print(type(y4),y4)
################################################################
y2 = np.frombuffer(y4, dtype=np.uint8)#byte转ndarray
print(type(y2),y2)