#if you want to initialize a 9*9 two-dimensional array [([""]*9) for i in range(9)] #caution: the follow code can't work [[""]*9]*9 shallow copies of list concatenated if you change one row then the prefix row will also be changed
from array import array """ 'b' signed char int 1 'B' unsigned char int 1 'u' Py_UNICODE Unicode character 2 (1) 'h' signed short int 2 'H' unsigned short int 2 'i' signed int int 2 'I' unsigned int int 2 'l' signed long int 4 'L' unsigned
np array转json import numpy as np import codecs, json a = np.arange().reshape(,) # a by array b = a.tolist() # nested lists with same data, indices file_path = "/path.json" ## your path variable json.dump(b, codecs.open(file_path, ) ### this save
目录: 1. 数组每一行除以这一行的总数(numpy divide row by row sum) 2. 数组每一行或者每一列求平均 (python average array columns or rows) 3. 数组每一行或者每一列求加权平均 (python weight average array columns or rows) 4. 计算数组得到每一行或者每一列的和 (python sum columns of an array) 5. 生成指定维度的随机矩阵 (python gen