Python将十进制定点列表转换为弧度 [英] Python Convert Decimal Fixed Point List to Radians

查看:89
本文介绍了Python将十进制定点列表转换为弧度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个十进制定点数列表:

I have a list of decimal fixed point numbers:

latitude = Places.query.with_entities(Places.latitude).all()
result = []
for i in range(len(latitude)):
    result.append(latitude[i][0])
print result

纬度的输出是this我想将它们映射到弧度.所以,我这样做了:

The output of latitude is this I wanted to map them to Radians. So, I did this:

lat_ = map(lambda i: radians(i), result)

但出现错误TypeError: a float is required

But got an errorTypeError: a float is required

我想知道执行此操作的正确方法是什么.`

I want to know what is the correct way to do this operation. `

编辑

现在的结果是这样的:

[28.633, 29.333,...]

错误是:

TypeError: float() argument must be a string or a number

推荐答案

试试这个:

rads = [x['latitude'] for x in result]
_lat = map(lambda i: radians(i), rads)

这篇关于Python将十进制定点列表转换为弧度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆