構造化された numpy 配列で np.ceil 関数を使用しようとしていますが、表示されるのはエラー メッセージだけです。
TypeError: ufunc 'ceil' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
その配列がどのように見えるかの簡単な例を次に示します。
arr = np.array([(1.4,2.3), (3.2,4.1)], dtype=[("x", "<f8"), ("y", "<f8")])
やってみると
np.ceil(arr)
上記のエラーが発生します。1 つの列だけを使用すると、次のように機能します。
In [77]: np.ceil(arr["x"])
Out[77]: array([ 2., 4.])
しかし、配列全体を取得する必要があります。列ごとに移動するか、構造化配列を一緒に使用しない以外に方法はありますか?