标签:专题 十六 als 标准 flat lse code 提取 判断
import numpy as np import pandas as pd import warnings warnings.filterwarnings("ignore")
备注:使用numpy生成6行6列的二维数组,值为1-100随机数
data = np.random.randint(1,100, [6,6])
data
np.amax(data, axis=0)
np.amin(data, axis=1)
np.unique(data,return_counts=True)
data.argsort()
np.repeat(data, 2, axis=0)
np.unique(data,axis = 0)
备注:从data的第一行中不放回抽3个元素
np.random.choice(data[0:1][0], 3, replace=False)
a = data[1:2] b = data[2:3] index=np.isin(a,b) array=a[~index] array
(~data.any(axis=1)).any()
data.sort(axis = 1)
data
data1 = data.astype(float)
data1[data1 < 5] = np.nan
data1
data1 = data1[~np.isnan(data1).any(axis=1), :]
data1
vals, counts = np.unique(data1[0,:], return_counts=True) print(vals[np.argmax(counts)])
a = 100
data1.flat[np.abs(data1 - a).argmin()]
data1 - data1.mean(axis=1, keepdims=True)
a = np.max(data1) - np.min(data1)
(data1 - np.min(data1)) / a
mu = np.mean(data1, axis=0) sigma = np.std(data1, axis=0) (data1 - mu) / sigma
np.savetxt(‘test.txt‘,data1)
数据可视化基础专题(二十六):numpy80题(五)NumPy进阶修炼第三期|41-60
标签:专题 十六 als 标准 flat lse code 提取 判断
原文地址:https://www.cnblogs.com/qiu-hua/p/14729103.html