
Numpy
牛右刀薛面
Know-what and Know-how
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Numpy_where
1、介绍numpy.where(condition[,x,y])numpy.where(condition[, x, y])numpy.where(condition[,x,y])类似与数据库里面的where语句,只要在括号里面ba判断条件打出来,那么就会输出满足条件元素的具体索引2、实例data = np.arange(25).reshape(5,5)print(np.where(data == 16))#(array([3]), array([1]))...原创 2021-09-07 19:38:55 · 89 阅读 · 0 评论 -
(1)numpy.power
1、作用类似于math.pow函数的作用,但是比其更加强大。通过理解下面的三个例子体会np.power的功能2、例子import pandas as pdimport numpy as np#让数组的每一个数都做n次幂运算x1 = np.arange(6)print(x1)print(np.power(x1,2))# [ 0 1 4 9 16 25]#列数和原数组一致的数组,原数组的每个元素对应的幂运算由x2数组决定x2 = [1.0, 2.0, 3.0, 3.0, 2.0,原创 2021-09-07 12:34:20 · 943 阅读 · 0 评论