Skip to content

DOC: incorrect example result for pd.merge_ordered #19393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ZhuBaohe opened this issue Jan 25, 2018 · 1 comment · Fixed by #19401
Closed

DOC: incorrect example result for pd.merge_ordered #19393

ZhuBaohe opened this issue Jan 25, 2018 · 1 comment · Fixed by #19401
Labels
Docs good first issue Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@ZhuBaohe
Copy link
Contributor

Exsample result for 'merge_ordered' function in documentation is wrong.
https://pandas-docs.github.io/pandas-docs-travis/generated/pandas.merge_ordered.html?highlight=merge_ordered#pandas.merge_ordered

The result should be:

key lvalue group rvalue
0 a 1 a NaN
1 b 1 a 1.0
2 c 2 a 2.0
3 d 2 a 3.0
4 e 3 a 3.0
5 a 1 b NaN
6 b 1 b 1.0
7 c 2 b 2.0
8 d 2 b 3.0
9 e 3 b 3.0

@jreback
Copy link
Contributor

jreback commented Jan 25, 2018

This is probably some old copy-paste text.

Would you do a PR to update and add a test to validate this

In [8]:         left = DataFrame({'key': ['a', 'c', 'e', 'a', 'c', 'e'],
   ...:                                'lvalue': [1, 2, 3, 1, 2, 3], 'group': list('aaabbb')})
   ...: 
   ...:         right = DataFrame({'key': ['b', 'c', 'd'],
   ...:                                 'rvalue': [1, 2, 3]}
   ...:                        
   ...:                        )
   ...: 

In [9]: 

In [9]: pd.merge_ordered(left, right, fill_method='ffill', left_by='group')
Out[9]: 
  group key  lvalue  rvalue
0     a   a       1     NaN
1     a   b       1     1.0
2     a   c       2     2.0
3     a   d       2     3.0
4     a   e       3     3.0
5     b   a       1     NaN
6     b   b       1     1.0
7     b   c       2     2.0
8     b   d       2     3.0
9     b   e       3     3.0

@jreback jreback added Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode Effort Low good first issue labels Jan 25, 2018
@jreback jreback added this to the Next Major Release milestone Jan 25, 2018
@jreback jreback changed the title Wrong exsample result for 'merge_ordered' function DOC: incorrect example result for pd.merge_ordered Jan 25, 2018
raph-m pushed a commit to raph-m/pandas that referenced this issue Jan 25, 2018
… merge_ordered. adding a test corresponding to this example.
@jorisvandenbossche jorisvandenbossche modified the milestones: Next Major Release, 0.23.0 Jan 26, 2018
jorisvandenbossche pushed a commit that referenced this issue Jan 26, 2018
* issue #19393. update of incorrect documentation example for merge_ordered. adding a test corresponding to this example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs good first issue Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants