将ndarray转换为字符串数组
假设有数组
values = [[ 116.17265886, 39.92265886, 116.1761427 , 39.92536232],
[ 116.20749721, 39.90373467, 116.21098105, 39.90643813],
[ 116.21794872, 39.90373467, 116.22143255, 39.90643813]]
现在我想将其转换为
values = [[ '116.17265886', '39.92265886', '116.1761427' , '39.92536232'],
[ '116.20749721', '39.90373467', '116.21098105', '39.90643813'],
[ '116.21794872', '39.90373467', '116.22143255', '39.90643813']]
Lets say there is array
values = [[ 116.17265886, 39.92265886, 116.1761427 , 39.92536232],
[ 116.20749721, 39.90373467, 116.21098105, 39.90643813],
[ 116.21794872, 39.90373467, 116.22143255, 39.90643813]]
now I want to convert this to
values = [[ '116.17265886', '39.92265886', '116.1761427' , '39.92536232'],
[ '116.20749721', '39.90373467', '116.21098105', '39.90643813'],
[ '116.21794872', '39.90373467', '116.22143255', '39.90643813']]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您确实有一个numpy数组(不是列表),则可以使用
astype(str)
:输出:
Assuming you really have a numpy array (not a list of list), you can use
astype(str)
:output:
如果它不是一个numpy数组,它是值列表的列表,以下代码应起作用:
对于每个列表,它返回每个值更改为字符串的列表,则返回以下内容。
If it's not a numpy array and it is a list of a list of values the following code should work:
For each list it returns a list of each of the values changed to a string, this returns the following.