The function of adding columns and rows to the numpy array
This article mainly talks about "the function of adding columns and rows to the numpy array". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the function of adding columns and rows to the numpy array.
Def fun_ndarray (): a = np.array (a) b = np.array (a) b = np.array (b) a_b_column = np.column_stack ((a) B)) # concatenate a_b_row = np.row_stack ((AMagneb)) according to column # splice print ('axib column') print (a_b_column) print (a_b_row) up and down according to row
Results:
The argument to the note:column_stack,row_stack function is a tuple
Np.delete (): delete rows or columns
Data = np.delete (data,3,axis=1) # delete the fourth column here, I believe you have a better understanding of "the function of adding columns and rows to the numpy array", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!