I'm reading in data and trying to create a NumPy array of shape (194, 1). So it should look like: [[4], [0], [9], ...]
I'm doing this:
def parse_data(file_name):
data = []
target = []
with open(file_name) as f:
for line in f:
temp = line.split()
x = [float(x) for x in temp[:2]]
y = float(temp[2])
data.append(np.array(x))
target.append(np.array(y))
return np.array(data), np.array(target)
x, y = parse_data("data.txt")
when I inspect y.shape, it's (194,), not (194,1) as I expected.
The x has shape (194,2) as I'd expect, however.
Any idea what I'm doing incorrectly?
Thanks!
data.txt?