I have a .txt file containing int, string and floats. How can I import this .txt file as a matrix while keeping strings?
Dataset contains:
16 disk 11 10.29 4.63 30.22 nan
79 table 11 20.49 60.60 20.22 nan
17 disk 11 22.17 0.71 10.37 nan
I used:
data=np.loadtxt("/home/Desktop/dataset.txt", delimiter=',')
the result is:
items = [conv(val) for (conv, val) in zip(converters, vals)]
ValueError: could not convert string to float: disk
In another try I used:
data = np.genfromtxt('/home/Desktop/dataset.txt', delimiter=",")
The result is:
16.0 nan 11 10.29 4.63 30.22
79.0 nan 11 20.49 60.60 20.22
17.0 nan 11 22.17 0.71 10.37