merging module¶
Functions for merging arrays.
merge_func_config HybridConfig¶
Config for merging functions.
HybridConfig(
concat=<function concat_merge at 0x132543ec0>,
row_stack=<function row_stack_merge at 0x132543f60>,
column_stack=<function column_stack_merge at 0x132574040>,
reset_column_stack=functools.partial(<function column_stack_merge at 0x132574040>, reset_index=True),
from_start_column_stack=functools.partial(<function column_stack_merge at 0x132574040>, reset_index='from_start'),
from_end_column_stack=functools.partial(<function column_stack_merge at 0x132574040>, reset_index='from_end'),
imageio=<function imageio_merge at 0x1325740e0>
)
column_stack_arrays function¶
Stack arrays along columns.
column_stack_merge function¶
column_stack_merge(
*objs,
reset_index=None,
fill_value=nan,
keys=None,
filter_results=True,
raise_no_results=True,
wrap=None,
wrapper=None,
wrap_kwargs=None,
clean_index_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, orwrap_kwargsare 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¶
Concatenate arrays.
concat_merge function¶
concat_merge(
*objs,
keys=None,
filter_results=True,
raise_no_results=True,
wrap=None,
wrapper=None,
wrap_kwargs=None,
clean_index_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,
filter_results=True,
raise_no_results=True,
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¶
Return whether the merging function can be found in merge_func_config.
mixed_merge function¶
Merge objects of mixed types.
resolve_merge_func function¶
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¶
Stack arrays along rows.
row_stack_merge function¶
row_stack_merge(
*objs,
keys=None,
filter_results=True,
raise_no_results=True,
wrap=None,
wrapper=None,
wrap_kwargs=None,
clean_index_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, orwrap_kwargsare 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.