#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Jia ShiLin
import numpy as np
t = np.arange(24).reshape((4, 6))
print(t)
print(t > 20)#布尔索引
print(t[t > 20])#布尔索引
t[t > 20] = 11#布尔索引
print(t)
# np.where三目函数
np.where(t > 10, 3, 1)
print(t)
numpy中数组布尔索引
最新推荐文章于 2024-05-22 01:13:49 发布