Вот к решению. Я должен был нарезать полосу данных, затем транспонировать ее и складывать по столбцам. После этого шага np.vstack сработало и все в порядке.
X = np.array([], dtype=np.int8).reshape(0,9) # pixels for training
y = np.array([], dtype=np.int8) # labels for training
# extract the raster values within the polygon
with rio.open(sentinal_band_paths[7]) as src:
band_count = src.count
for index, geom in enumerate(geoms):
feature = [mapping(geom)]
# the mask function returns an array of the raster pixels within this feature
out_image, out_transform = mask(src, feature, crop=True)
# eliminate all the pixels with 0 values for all 8 bands - AKA not actually part of the shapefile
out_image_trimmed = out_image[:,~np.all(out_image == 0, axis=0)]
# eliminate all the pixels with 255 values for all 8 bands - AKA not actually part of the shapefile
out_image_trimmed = out_image_trimmed[:,~np.all(out_image_trimmed == 255, axis=0)]
# reshape the array to [pixel count, bands]
out_image_reshaped = out_image_trimmed.reshape(-1, band_count)
# reshape the array to [pixel count, bands]
trial = np.split(out_image_trimmed, 9)##### share it to equally after bands
B1 = trial[0].T ####transpons columns
B2 = trial [1].T
B3 = trial [2].T
B4 = trial [3].T
B5 = trial [4].T
B6= trial [5].T
B7 = trial [6].T
B8 = trial [7].T
B9 = trial[8].T
colum_data = np.column_stack((B1,B2,B3,B4,B5,B6,B7,B8,B9))####concatenate data colum wise
# append the labels to the y array
y = np.append(y,[shapefile["id"][index]] * out_image_reshaped.shape[0])
# stack the pizels onto the pixel array
X = np.vstack((X,colum_data ))