newaxis = MultiAxis(*[ax for ax in self.axes if ax.name in dims]) # New axes newaxes = [ax for ax in self.axes if ax.name not in dims] newaxes.insert(insert, newaxis) # Reshape the actual array values newshape = [ax.size for ax in newaxes] newvalues = self.values.reshape(newshape) # Define the new array new = self._constructor(newvalues, newaxes, **self.attrs) return new group = deprecated_func(flatten, 'group') def unflatten(self, axis=None): """ undo flatten (inflate array) Parameters ---------- axis : int or str or None, optional axis to unflatten default to None to unflatten all Returns ------- DimArray """
#from transform import * #from reshape import * #from indexing import * #from interpolation import * #from missingvalues import * from __future__ import absolute_import from dimarray.tools import pandas_obj, deprecated_func from .dimarraycls import DimArray, array, empty, zeros, ones, nans, empty_like, zeros_like, ones_like, nans_like, from_pandas, from_arrays from .axes import Axis, Axes, MultiAxis from .align import broadcast_arrays, align, concatenate, stack, align_dims # deprecated functions align_axes = deprecated_func(align, "align_axes")