numpy hstack: How to find the correct dimensions

Viewed 103

I am trying to stack two numpy arrays together.

The first has dimensions (1797, 64) and the second has dimensions (1797,). I want to create an array with dimensions (1797, 65). This should be possible through np.hstack():

from sklearn import datasets
import numpy as np

digits = datasets.load_digits(n_class=10)
data = np.array(digits.data)
labels = np.array(digits.target)
myData = np.hstack((data, labels[:,None]))

print(data)
print(labels)
print(myData)

However, when you run the code given above, you will see that data and the first 64 columns of myData are not equal. Can somebody explain to me what is going on?

0 Answers
Related