import numpy as np
a = np.array([10,4,6,7])
b = np.arange(4)# 两数组值相加
c=a+b
# 数组的值平方
d=b**2# 两数组对应的值相乘
e=a*b
# 两数组对应的值相除
f=c/a
# 两数组对应的值取余
g=c%a
# 两数组对应的值整除
h=c//a
print(a,b)print(c,d)print(e)print(f)print(g)print(h)[10467][0123][105810][0149][041221][1.1.251.333333331.42857143][0123][1111]
2、比较运算符
import numpy as np
a = np.array([10,4,6,7])
b = np.arange(4)print(a,b)print(np.greater(a,b))print(np.greater_equal(a,b))print(np.less(a,b))print(np.less_equal(a,b))print(np.equal(a,b))print(np.not_equal(a,b))[10467][0123][TrueTrueTrueTrue][TrueTrueTrueTrue][FalseFalseFalseFalse][FalseFalseFalseFalse][FalseFalseFalseFalse]
3、常用的数学函数
import numpy as np
a = np.array([10,4,6,7])
b = np.arange(4)
c=a+b
d =c/a
e=b**2print(a,b,c,d,e)print(np.round(d))print(np.square(e))print(np.sqrt(e))print(np.exp(b))print(np.power(b,2))print(np.log2(a))print(np.log10(a))print(np.log(a))[10467][0123][105810][1.1.251.333333331.42857143][0149][1.1.1.1.][011681][0.1.2.3.][1.2.718281837.389056120.08553692][0149][3.321928092.2.58496252.80735492][1.0.602059990.778151250.84509804][2.302585091.386294361.791759471.94591015]
4、常用的统计函数
import numpy as np
arr2 = np.array(((8.5,6,4.1,2,0.7),(1.5,3,5.4,7.3,9),(3.2,3,3.8,3,3),(11.2,13.4,15.6,17.8,19)))# 计算每一行的和
Sum =[]for row inrange(4):
Sum.append(np.sum(arr2[row,:]))print(Sum)# 计算每一列的平均
Avg =[]for col inrange(5):
Avg.append(np.mean(arr2[:,col]))print(Avg)print(arr2.sum(axis =1))print(np.sum(arr2, axis =1))print(np.mean(arr2, axis =0))[21.3,26.2,16.0,77.0][6.1,6.35,7.225,7.525,7.925][21.326.216.77.][21.326.216.77.][6.16.357.2257.5257.925]
在OceanBase的问答区和开源社区钉钉群聊中,时常会有关于全局索引 global index的诸多提问,因此,借这篇博客,针对其中一些普遍出现的问题进行简要的解答。 什么是 global index ?
由于 MySQL 不具备 global index 的概…