TypeError:只有size1数组可以转换为Python标量jupyter noteb

2024-06-30 13:43:55 发布

您现在位置:Python中文网/ 问答频道 /正文

当我尝试运行这段代码时,python说只有size-1数组可以转换成python标量。在

现在是我的输入:deltaDEC1deltaRA1Data_match['DEC_1']所有数组1行1列。我想从中得到一个1行1列的数组。在

r1 = math.sqrt(((deltaDEC1)**2)+((deltaRA1)**2)*((math.cos(Data_match['DEC_1']))**2))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-535-95d3dd661960> in <module>()

----> 1 r1 = math.sqrt(((deltaDEC1)**2)+((deltaRA1)**2)*((math.cos(Data_match['DEC_1']))**2))

TypeError: only size-1 arrays can be converted to Python scalars

我是python新手,所以不知道如何修复这个错误。在


Tags: 代码datasizematchmathsqrt数组cos