pythonarraysmergecombiners

Combining two arrays in python term by term


long =np.array(data.Longitude)
lat = np.array(data.Latitude)
coordinates = np.array(385)
for i in range(385):
    coordinates[i] = np.array([lat[i], long[i]])



#x, y = kmeans2(whiten(coordinates), 3, iter = 20)  
#plt.scatter(coordinates[:,0], coordinates[:,1], c=y);
#plt.show()

I have a dataset with two columns and I wish to merge the latitude and longitude term by term to apply k means clustering after that.Please help with the array part


Solution

  • coordinates = np.array([lat, long])
    

    or am I missing sth here...