Array Manipulation Routines

The following tables show array manipulation routines provided by NLCPy.

Basic Operations

nlcpy.shape

Returns the shape of an array.

nlcpy.copyto

Copies values from one array to another, broadcasting as necessary.

Changing Array Shape

nlcpy.reshape

Gives a new shape to an array without changing its data.

nlcpy.ravel

Returns a contiguous flattened array.

Transpose-like Operations

nlcpy.moveaxis

Moves axes of an array to new positions.

nlcpy.rollaxis

Rolls the specified axis backwards, until it lies in a given position.

nlcpy.swapaxes

Interchanges two axes of an array.

nlcpy.transpose

Permutes the dimensions of an array.

Changing Number of Dimensions

nlcpy.atleast_1d

Converts inputs to arrays with at least one dimension.

nlcpy.atleast_2d

Views inputs as arrays with at least two dimensions.

nlcpy.atleast_3d

Views inputs as arrays with at least three dimensions.

nlcpy.broadcast_arrays

Broadcasts any number of arrays against each other.

nlcpy.broadcast_to

Broadcasts an array to a new shape.

nlcpy.expand_dims

Expands the shape of an array.

nlcpy.squeeze

Removes single-dimensional entries from the shape of an array.

Joining Arrays

nlcpy.concatenate

Joins a sequence of arrays along an existing axis.

nlcpy.hstack

Stacks arrays in sequence horizontally (column wise).

nlcpy.stack

Joins a sequence of arrays along a new axis.

nlcpy.vstack

Stacks arrays in sequence vertically (row wise).

nlcpy.block

Assembles an nd-array from nested lists of blocks.

Splitting arrays

nlcpy.split

Splits an array into multiple sub-arrays.

nlcpy.hsplit

Splits an array into multiple sub-arrays horizontally (column-wise).

nlcpy.vsplit

Splits an array into multiple sub-arrays vertically (row-wise).

Tiling Arrays

nlcpy.tile

Constructs an array by repeating A the number of times given by reps.

nlcpy.repeat

Repeats elements of an array.

Adding and Removing Elements

nlcpy.append

Appends values to the end of an array.

nlcpy.delete

Returns a new array with sub-arrays along an axis deleted.

nlcpy.insert

Inserts values along the given axis before the given indices.

nlcpy.resize

Returns a new array with the specified shape.

nlcpy.unique

Finds the unique elements of an array.

Rearranging Elements

nlcpy.flip

Reverses the order of elements in an array along the given axis.

nlcpy.fliplr

Flips array in the left/right direction.

nlcpy.flipud

Flips array in the up/down direction.

nlcpy.roll

Rolls array elements along a given axis.