merge_asof

merge_asof#

Catalog.merge_asof(other: Catalog, direction: str = 'backward', suffixes: tuple[str, str] | None = None, output_catalog_name: str | None = None, suffix_method: str | None = None, log_changes: bool = True)[source]#

Uses the pandas merge_asof function to merge two catalogs on their indices by distance of keys

Must be along catalog indices, and does not include margin caches, meaning results may be incomplete for merging points.

This function is intended for use in special cases such as Dust Map Catalogs, for general merges, the crossmatch and join functions should be used.

Parameters:
otherlsdb.Catalog

The right catalog to merge to

suffixestuple[str,str]

The suffixes to apply to each partition’s column names

directionstr, default “backward”

The direction to perform the merge_asof

output_catalog_namestr

The name of the resulting catalog to be stored in metadata

suffix_methodstr, default “all_columns”

Method to use to add suffixes to columns. Options are:

  • “overlapping_columns”: only add suffixes to columns that are present in both catalogs

  • “all_columns”: add suffixes to all columns from both catalogs

Warning

This default will change to “overlapping_columns” in a future release.

log_changesbool, default True

If True, logs an info message for each column that is being renamed. This only applies when suffix_method is ‘overlapping_columns’.

Returns:
Catalog

A new catalog with the columns from each of the input catalogs with their respective suffixes added, and the rows merged using merge_asof on the specified columns.