Skip to content
New: Star-import, signal unraveling, Python 3.12 support, and more

# merging module

Functions for merging arrays.

## merge_func_config HybridConfig

Config for merging functions.

    HybridConfig(
        concat=<function concat_merge at 0x7ff34a2e5c60>,
        row_stack=<function row_stack_merge at 0x7ff34a2e5d80>,
        column_stack=<function column_stack_merge at 0x7ff34a2e5e10>,
        reset_column_stack=functools.partial(<function column_stack_merge at 0x7ff34a2e5e10>, reset_index=True),
        from_start_column_stack=functools.partial(<function column_stack_merge at 0x7ff34a2e5e10>, reset_index='from_start'),
        from_end_column_stack=functools.partial(<function column_stack_merge at 0x7ff34a2e5e10>, reset_index='from_end'),
        imageio=<function imageio_merge at 0x7ff34a2e5ea0>
    )

## column_stack_arrays function

    column_stack_arrays(
        *arrs,
        expand_axis=1
    )

Stack arrays along columns.

## column_stack_merge function

    column_stack_merge(
        *objs,
        reset_index=None,
        fill_value=nan,
        keys=None,
        wrap=None,
        wrapper=None,
        wrap_kwargs=None,
        index_stack_kwargs=None,
        **kwargs
    )

Merge multiple array-like or Wrapping objects through column stacking.

Supports a sequence of tuples.

Argument `wrap` supports the following options:

- None: will become True if `wrapper`, `keys`, or `wrap_kwargs` are not None
- True: each array will be wrapped with Pandas Series/DataFrame (depending on dimensions)
- 'sr', 'series': each array will be wrapped with Pandas Series
- 'df', 'frame', 'dataframe': each array will be wrapped with Pandas DataFrame

Without wrapping, arrays will be kept as-is and merged using column_stack_arrays(). Argument `wrap_kwargs` can be a dictionary or a list of dictionaries.

If `wrapper` is provided, will use ArrayWrapper.wrap().

Keyword arguments `**kwargs` are passed to `pd.concat` and Wrapping.column_stack() only.

Argument `reset_index` supports the following options:

- False or None: Keep original index of each object
- True or 'from_start': Reset index of each object and align them at start
- 'from_end': Reset index of each object and align them at end

Options above work on Pandas, NumPy, and Wrapping instances.

Note

All arrays are assumed to have the same type and dimensionality.

## concat_arrays function

    concat_arrays(
        *arrs
    )

Concatenate arrays.

## concat_merge function

    concat_merge(
        *objs,
        keys=None,
        wrap=None,
        wrapper=None,
        wrap_kwargs=None,
        index_stack_kwargs=None,
        **kwargs
    )

Merge multiple array-like objects through concatenation.

Supports a sequence of tuples.

If `wrap` is None, it will become True if `wrapper`, `keys`, or `wrap_kwargs` are not None. If `wrap` is True, each array will be wrapped with Pandas Series and merged using `pd.concat`. Otherwise, arrays will be kept as-is and merged using concat_arrays(). `wrap_kwargs` can be a dictionary or a list of dictionaries.

If `wrapper` is provided, will use ArrayWrapper.wrap_reduced().

Keyword arguments `**kwargs` are passed to `pd.concat` only.

Note

All arrays are assumed to have the same type and dimensionality.

## imageio_merge function

    imageio_merge(
        *objs,
        keys=None,
        to_image_kwargs=None,
        imread_kwargs=None,
        **imwrite_kwargs
    )

Merge multiple figure-like objects by writing them with `imageio`.

Keyword arguments `to_image_kwargs` are passed to `plotly.graph_objects.Figure.to_image`. Keyword arguments `imread_kwargs` and `**imwrite_kwargs` are passed to `imageio.imread` and `imageio.imwrite` respectively.

Keys are not used in any way.

## is_merge_func_from_config function

    is_merge_func_from_config(
        merge_func
    )

Return whether the merging function can be found in merge_func_config.

## mixed_merge function

    mixed_merge(
        *objs,
        merge_funcs=None,
        keys=None,
        mixed_kwargs=None,
        **kwargs
    )

Merge objects of mixed types.

## resolve_merge_func function

    resolve_merge_func(
        merge_func
    )

Resolve a merging function into a callable.

If a string, looks up into merge_func_config. If a sequence, uses mixed_merge() with `merge_funcs=merge_func`. If an instance of MergeFunc, calls MergeFunc.resolve_merge_func() to get the actual callable.

## row_stack_arrays function

    row_stack_arrays(
        *arrs,
        expand_axis=1
    )

Stack arrays along rows.

## row_stack_merge function

    row_stack_merge(
        *objs,
        keys=None,
        wrap=None,
        wrapper=None,
        wrap_kwargs=None,
        index_stack_kwargs=None,
        **kwargs
    )

Merge multiple array-like or Wrapping objects through row stacking.

Supports a sequence of tuples.

Argument `wrap` supports the following options:

- None: will become True if `wrapper`, `keys`, or `wrap_kwargs` are not None
- True: each array will be wrapped with Pandas Series/DataFrame (depending on dimensions)
- 'sr', 'series': each array will be wrapped with Pandas Series
- 'df', 'frame', 'dataframe': each array will be wrapped with Pandas DataFrame

Without wrapping, arrays will be kept as-is and merged using row_stack_arrays(). Argument `wrap_kwargs` can be a dictionary or a list of dictionaries.

If `wrapper` is provided, will use ArrayWrapper.wrap().

Keyword arguments `**kwargs` are passed to `pd.concat` and Wrapping.row_stack() only.

Note

All arrays are assumed to have the same type and dimensionality.

#### Cookie consent

We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.

- Google Analytics
- GitHub

Manage settings