How to convert numpy object array into str/unicode array?

后端 未结 2 1843
执笔经年
执笔经年 2021-02-07 13:15

Update: In lastest version of numpy (e.g., v1.8.1), this is no longer a issue. All the methods mentioned here now work as excepted.

Original qu

2条回答
  •  鱼传尺愫
    2021-02-07 13:47

    At least in Python 3.5 Jupyter 4 I can use:

    a=np.array([u'12345',u'abc'],dtype=object)
    b=a.astype(str)
    b
    

    works just fine for me and returns:

    array(['12345', 'abc'],dtype='

提交回复
热议问题