我有一个numpy数组BJD
:
array(['2457217.463668', '2457217.484100', '2457217.504533', ...,
'2457296.330660', '2457296.351092', '2457296.371524'], dtype='<U14')
我想把每个元素除以period
,一个数字,然后得到余数。我再次创建一个numpy数组:
periodarray
这是:
array(['0.5742000365944918', '0.5742000365944918', '0.5742000365944918',
..., '0.5742000365944918', '0.5742000365944918',
'0.5742000365944918'], dtype='<U18')
然后,为了得到余数数组,我需要:
remainders=np.mod(BJD,periodarray)
我得到这个错误:
TypeError: ufunc 'remainder' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
是不是一个数组的数据类型是U14,另一个是U18?如果是,我该怎么解决?一种解决方案虽然不能准确地解决问题,但提供了一种获得余数数组的更简单的方法,这也是受欢迎的。在
目前没有回答
相关问题 更多 >
编程相关推荐