


# https://www.globalsino.com/ICs/page4853.html
# Find the index of an elements, and then change/modify elements in Numpy

import numpy as np

A = np.round(10*np.random.rand(5,4))

# Print the array
print('Print the array:')
print(A)

# Access the element at the second row, the third entry
print('\nAccess the second row, the third entry:')
print(A[1,2])

# Access the second row
print('\nAccess the second row')
print(A[1,:])

# Access the second column
print('\nAccess the second column')
print(A[:,1])

# Access some elements (submatrix)
print('\nAccess some elements (submatrix):')
print(A[1:3, 2:4])

# Replace an element in the array
print('\nReplace an element in the array:')
A[1,2] = 1967
print(A)

# Print transfer
print('\nTransfer:')
print(A.T)

