So, I have a text document with many names and numbers in 2 separate columns, 1 column for numbers, 1 for names. I know how to take out the column of numbers, but it does not work on strings.
Code:
import numpy as np
f = np.loadtxt("testfil.txt", int)
index = f[:, 0]
f = np.loadtxt("testfil.txt", str)
name = f[:, 1]
print(index, name)
The first part works with the integers, but with strings there´s a ValueError which says:
ValueError: could not convert string to float: 'James'
James is just the first name in the list.