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

后端 未结 2 1841
执笔经年
执笔经年 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:55

    I know this is an old question but in case anyone comes across it and is looking for an answer, try

    c = a.astype('U')
    

    and you should get the result you expect:

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

提交回复
热议问题