Write a NumPy program to save as text a matrix which has in each row 2 float and 1 string at the end.
import numpy as np matrix = [[1, 0, 'aaa'], [0, 1, 'bbb'], [0, 1, 'ccc']] np.savetxt('test', matrix, delimiter=' ', header='string', comments='', fmt='%s')
Sample Output:
string 1 0 aaa 0 1 bbb 0 1 ccc
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output: