{"title":"\u3010Python/NumPy\u3011MaskedArray\u3068ndarray\u306e\u9055\u3044\u3068\u6ce8\u610f\u70b9\uff5c\u30c7\u30fc\u30bf\u6b20\u640d\u51e6\u7406\u306e\u843d\u3068\u3057\u7a74","categories":["Python","Numpy"],"published":"2025-06-15 13:55:18","type":"rich","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fwww.yuta-nakata.net%2Fentry%2F2025%2F06%2F15%2F135518\" title=\"\u3010Python/NumPy\u3011MaskedArray\u3068ndarray\u306e\u9055\u3044\u3068\u6ce8\u610f\u70b9\uff5c\u30c7\u30fc\u30bf\u6b20\u640d\u51e6\u7406\u306e\u843d\u3068\u3057\u7a74 - Yuta Nakata\u306eBlog\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","width":"100%","image_url":null,"description":"\u56f0\u3063\u305f\u70b9 import numpy as np data = np.array([1.23, 4.56, 7.89], dtype=np.float32) no_value = np.float32(-9999) factor = 100 data = np.ma.masked_equal(data, no_value) # 1. Using data[~data.mask] result1 = data[~data.mask] * factor print(result1) # [[123.00000191 455.99999428 788.99998665]] print(type(res\u2026","version":"1.0","author_url":"https://blog.hatena.ne.jp/yuta-nakata/","url":"https://www.yuta-nakata.net/entry/2025/06/15/135518","height":"190","blog_url":"https://www.yuta-nakata.net/","provider_name":"Hatena Blog","provider_url":"https://hatena.blog","blog_title":"Yuta Nakata\u306eBlog","author_name":"yuta-nakata"}