";require "../templates/head_jq_bs4.php";echo "";echo "
";$img_path="..";//require "top-link-tkinter.php";require "templates/top_bs4.php"; echo "import numpy as npnpr=np.array([[0,1,2,4],[3,4,5,6],[6,7,8,9]]) # print(npr.ndim) # 2print(npr.shape) # (3,4)print(npr) npr1=np.append(npr,[[10,11,12,13]],axis=0)print(npr1)Output2(3, 4)[[0 1 2 4] [3 4 5 6] [6 7 8 9]][[ 0 1 2 4] [ 3 4 5 6] [ 6 7 8 9] [10 11 12 13]]ValueError: all the input arrays must have same number of dimensionsimport numpy as npnpr=np.array([[0,1,2,4],[3,4,5,6],[6,7,8,9]]) npr1=np.array([[10,11,12,13],[21,22,23,24],[31,32,34,35]])npr2=np.append(npr,npr1,axis=0)print(npr2)Output[[ 0 1 2 4] [ 3 4 5 6] [ 6 7 8 9] [10 11 12 13] [21 22 23 24] [31 32 34 35]]Change the Axis to 1npr2=np.append(npr,npr1,axis=1) Output[[ 0 1 2 4 10 11 12 13] [ 3 4 5 6 21 22 23 24] [ 6 7 8 9 31 32 34 35]]
Numpy
random.randint , Random Integers