MCPcopy
hub / github.com/pandas-dev/pandas / __init__

Method __init__

pandas/core/reshape/merge.py:2316–2365  ·  view source on GitHub ↗
(
        self,
        left: DataFrame | Series,
        right: DataFrame | Series,
        on: IndexLabel | None = None,
        left_on: IndexLabel | None = None,
        right_on: IndexLabel | None = None,
        left_index: bool = False,
        right_index: bool = False,
        by=None,
        left_by=None,
        right_by=None,
        suffixes: Suffixes = ("_x", "_y"),
        how: Literal["asof"] = "asof",
        tolerance=None,
        allow_exact_matches: bool = True,
        direction: str = "backward",
    )

Source from the content-addressed store, hash-verified

2314 _merge_type = "asof_merge"
2315
2316 def __init__(
2317 self,
2318 left: DataFrame | Series,
2319 right: DataFrame | Series,
2320 on: IndexLabel | None = None,
2321 left_on: IndexLabel | None = None,
2322 right_on: IndexLabel | None = None,
2323 left_index: bool = False,
2324 right_index: bool = False,
2325 by=None,
2326 left_by=None,
2327 right_by=None,
2328 suffixes: Suffixes = ("_x", "_y"),
2329 how: Literal["asof"] = "asof",
2330 tolerance=None,
2331 allow_exact_matches: bool = True,
2332 direction: str = "backward",
2333 ) -> None:
2334 self.by = by
2335 self.left_by = left_by
2336 self.right_by = right_by
2337 self.tolerance = tolerance
2338 self.allow_exact_matches = allow_exact_matches
2339 self.direction = direction
2340
2341 # check 'direction' is valid
2342 if self.direction not in ["backward", "forward", "nearest"]:
2343 raise MergeError(f"direction invalid: {self.direction}")
2344
2345 # validate allow_exact_matches
2346 if not is_bool(self.allow_exact_matches):
2347 msg = (
2348 "allow_exact_matches must be boolean, "
2349 f"passed {self.allow_exact_matches}"
2350 )
2351 raise MergeError(msg)
2352
2353 _OrderedMerge.__init__(
2354 self,
2355 left,
2356 right,
2357 on=on,
2358 left_on=left_on,
2359 right_on=right_on,
2360 left_index=left_index,
2361 right_index=right_index,
2362 how=how,
2363 suffixes=suffixes,
2364 fill_method=None,
2365 )
2366
2367 def _validate_left_right_on(self, left_on, right_on):
2368 left_on, right_on = super()._validate_left_right_on(left_on, right_on)

Callers 1

__init__Method · 0.45

Calls 1

MergeErrorClass · 0.90

Tested by

no test coverage detected