I am trying a flatten a Numpy array but flatten, ravel, and hstack are not doing it. I need to be able to create a Pandas series from the array, but I can't seem to get it flat for Pandas to accept:
print(type(centroids))
# <class 'numpy.matrix'>
print(centroids.shape)
# (5, 9328)
centroid = centroids[i]
centroid = np.hstack(centroid)
print(centroid)
# [[ 0.98487911 0.7483803 11.80978353 ... 0.97687837 0.21988038
3.33842549]] <-- still enclosed by two brackets
print(centroid.shape)
# (1, 9328)
centroid = pd.Series(centroid, name='value') <-- throws exception: Exception: Data must be 1-dimensional