Reshape method to compliment flatten for Series objects
bainzo opened this issue · 0 comments
bainzo commented
Would it be possible to add a reshape
style method to the Series object?
Currently if you need to flatten a series, for instance to perform factorization, there is no native way of reshaping the resulting series' spatial dimensions to that of the original series.
A workaround involves calling np.reshape
with a concatenated tuple for the dimensions, for example,
w_reshape = np.reshape(w, ts.shape[:2] + w.shape[1])
However, if the series w
is on Spark this appears to collect w
before reshaping, and also returns an Numpy array which requires an extra step to make w
a series again.