How to convert singleton array to a scalar value in Python? July 23, 2023 by Tarik You can use the item() function: import numpy as np matrix = np.array([[[[7]]]]) print(matrix.item()) Output 7