Skip to content

Commit 9da7798

Browse files
jorisvandenbosscheTomAugspurger
authored andcommitted
DOC: add dataframe construction in merge_asof example (#16348)
1 parent 4bdbcb6 commit 9da7798

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/reshape/merge.py

+6
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,15 @@ def merge_asof(left, right, on=None,
347347
348348
Examples
349349
--------
350+
>>> left = pd.DataFrame({'a': [1, 5, 10], 'left_val': ['a', 'b', 'c']})
350351
>>> left
351352
a left_val
352353
0 1 a
353354
1 5 b
354355
2 10 c
355356
357+
>>> right = pd.DataFrame({'a': [1, 2, 3, 6, 7],
358+
... 'right_val': [1, 2, 3, 6, 7]})
356359
>>> right
357360
a right_val
358361
0 1 1
@@ -387,12 +390,15 @@ def merge_asof(left, right, on=None,
387390
388391
We can use indexed DataFrames as well.
389392
393+
>>> left = pd.DataFrame({'left_val': ['a', 'b', 'c']}, index=[1, 5, 10])
390394
>>> left
391395
left_val
392396
1 a
393397
5 b
394398
10 c
395399
400+
>>> right = pd.DataFrame({'right_val': [1, 2, 3, 6, 7]},
401+
... index=[1, 2, 3, 6, 7])
396402
>>> right
397403
right_val
398404
1 1

0 commit comments

Comments
 (0)