thunder-project / thunder

scalable analysis of images and time series
http://thunder-project.org
Apache License 2.0
814 stars 184 forks source link

Reshape method to compliment flatten for Series objects #335

Open bainzo opened 8 years ago

bainzo commented 8 years ago

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.