Permute the layer along an axis

		Args:
			axis: The axis to permute (0, permute the rows; 1, permute the columns)
			ordering: The permutation vector
504128
def permute(self, ordering: np.ndarray, *, axis: int) -> None:
		
		if axis == 0:
			self.values = self.values[ordering, :]
		elif axis == 1:
			self.values = self.values[:, ordering]
		else:
			raise ValueError("axis must be 0 or 1")
1133846
def swapaxes(self, axis1, axis2):
        """"""
        if self.ndim <=1 or axis1 == axis2:
            return self
        ar = np.asarray(self).swapaxes(axis1, axis2)
        if axis1 != 0 and axis2 != 0:
            # then axis 0 is unaffected by the swap
            labels = self.labels[:]
            labels[axis1], labels[axis2] = labels[axis2], labels[axis1]
            return Timeseries(ar, self.tspan, labels)
        return ar
62546
def shift(self, periods, axis=0, fill_value=None):
        

        # convert integer to float if necessary. need to do a lot more than
        # that, handle boolean etc also
        new_values, fill_value = maybe_upcast(self.values, fill_value)

        # make sure array sent to np.roll is c_contiguous
        f_ordered = new_values.flags.f_contiguous
        if f_ordered:
            new_values = new_values.T
            axis = new_values.ndim - axis - 1

        if np.prod(new_values.shape):
            new_values = np.roll(new_values, ensure_platform_int(periods),
                                 axis=axis)

        axis_indexer = [slice(None)] * self.ndim
        if periods > 0:
            axis_indexer[axis] = slice(None, periods)
        else:
            axis_indexer[axis] = slice(periods, None)
        new_values[tuple(axis_indexer)] = fill_value

        # restore original order
        if f_ordered:
            new_values = new_values.T

        return [self.make_block(new_values)]
1167285
def flip(a, axis):
    
    if not hasattr(a, 'ndim'):
        a = np.asarray(a)
    indexer = [slice(None)] * a.ndim
    try:
        indexer[axis] = slice(None, None, -1)
    except IndexError:
        raise ValueError('axis={} is invalid for the {}-dimensional input '
                         'array'.format(axis, a.ndim))
    return a[tuple(indexer)]
1365270
private void permutePivot(IntIntPair pos1, IntIntPair pos2) {
    int r1 = pos1.first;
    int c1 = pos1.second;
    int r2 = pos2.first;
    int c2 = pos2.second;
    int index;
    index = row[r2];
    row[r2] = row[r1];
    row[r1] = index;
    index = col[c2];
    col[c2] = col[c1];
    col[c1] = index;
  }
150881
def _get_list_axis(self, key, axis=None):
        
        if axis is None:
            axis = self.axis or 0
        try:
            return self.obj._take(key, axis=axis)
        except IndexError:
            # re-raise with different error message
            raise IndexError("positional indexers are out-of-bounds")
400000
def moveaxis(a, source, destination):
    
    import numpy
    if hasattr(numpy, 'moveaxis'):
        return numpy.moveaxis(a, source, destination)

    try:
        source = list(source)
    except TypeError:
        source = [source]
    try:
        destination = list(destination)
    except TypeError:
        destination = [destination]

    source = [ax + a.ndim if ax < 0 else ax for ax in source]
    destination = [ax + a.ndim if ax < 0 else ax for ax in destination]

    order = [n for n in range(a.ndim) if n not in source]

    for dest, src in sorted(zip(destination, source)):
        order.insert(dest, src)

    return a.transpose(order)
1010306
def transpose_axes(image, axes, asaxes=None):
    
    for ax in axes:
        if ax not in asaxes:
            raise ValueError('unknown axis %s' % ax)
    # add missing axes to image
    if asaxes is None:
        asaxes = 'CTZYX'
    shape = image.shape
    for ax in reversed(asaxes):
        if ax not in axes:
            axes = ax + axes
            shape = (1,) + shape
    image = image.reshape(shape)
    # transpose axes
    image = image.transpose([axes.index(ax) for ax in asaxes])
    return image
1195803
def index(self, axes):
        
        return None if axes is self._colormap_axes else self._axes.index(axes)
311011
def get_axis(array, axis, slice_num):
    """"""

    slice_list = [slice(None)] * array.ndim
    slice_list[axis] = slice_num
    slice_data = array[tuple(slice_list)].T  # transpose for proper orientation

    return slice_data
1032956
def setVerCrossPlotAutoRangeOn(self, axisNumber):
        
        setXYAxesAutoRangeOn(self, self.verCrossPlotRangeCti, self.yAxisRangeCti, axisNumber)
234665
def wrap_results_for_axis(self):
        

        results = self.results
        result = self.obj._constructor(data=results)

        if not isinstance(results[0], ABCSeries):
            try:
                result.index = self.res_columns
            except ValueError:
                pass

        try:
            result.columns = self.res_index
        except ValueError:
            pass

        return result
685534
private void randomPermute(int[] permute) {
        for (int i = 0; i < indexVectorSize; i++)
            permute[i] = i;
        for (int i = indexVectorSize - 1; i > 0; i--) {
            int w = (int) Math.floor(Math.random() * (i+1));
            int temp = permute[w];
            permute[w] = permute[i];
            permute[i] = permute[w];
        }
    }
1237372
def sort_index(self, axis=0, level=None, ascending=True, inplace=False,
                   kind='quicksort', na_position='last',
                   sort_remaining=True, by=None):
        
        return self._frame.sort_index(axis=axis, level=level,
                                      ascending=ascending, inplace=inplace,
                                      kind=kind, na_position=na_position,
                                      sort_remaining=sort_remaining, by=by)
881214
def rename_axis(self, mapper, axis, copy=True, level=None):
        
        obj = self.copy(deep=copy)
        obj.set_axis(axis, _transform_index(self.axes[axis], mapper, level))
        return obj
1058919
def _get_plane_axes_index(self, axis):
        
        axis_name = self._get_axis_name(axis)

        if axis_name == 'major_axis':
            index = 'minor_axis'
            columns = 'items'
        if axis_name == 'minor_axis':
            index = 'major_axis'
            columns = 'items'
        elif axis_name == 'items':
            index = 'major_axis'
            columns = 'minor_axis'

        return index, columns
234196
def _reindex_axes(self, axes, level, limit, tolerance, method, fill_value,
                      copy):
        """"""
        obj = self
        for a in self._AXIS_ORDERS:
            labels = axes[a]
            if labels is None:
                continue

            ax = self._get_axis(a)
            new_index, indexer = ax.reindex(labels, level=level, limit=limit,
                                            tolerance=tolerance, method=method)

            axis = self._get_axis_number(a)
            obj = obj._reindex_with_indexers({axis: [new_index, indexer]},
                                             fill_value=fill_value,
                                             copy=copy, allow_dups=False)

        return obj