Skip to content

DOC: additional join examples in "10 Minutes to pandas" #13029

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
DavidDobr opened this issue Apr 29, 2016 · 1 comment
Closed

DOC: additional join examples in "10 Minutes to pandas" #13029

DavidDobr opened this issue Apr 29, 2016 · 1 comment
Labels
Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Milestone

Comments

@DavidDobr
Copy link


Tutorial at pandas.pydata.org/pandas-docs/stable/10min.html has the following code, where the obvious mistake is having only 1 key "foo" instead of 2 keys: "foo" and "bar" throughout the whole example


Join

SQL style merges. See the Database style joining

In [77]: left = pd.DataFrame({'key': ['foo', 'foo'], 'lval': [1, 2]})

In [78]: right = pd.DataFrame({'key': ['foo', 'foo'], 'rval': [4, 5]})

In [79]: left
Out[79]: 
   key  lval
0  foo     1
1  foo     2

In [80]: right
Out[80]: 
   key  rval
0  foo     4
1  foo     5

In [81]: pd.merge(left, right, on='key')
Out[81]: 
   key  lval  rval
0  foo     1     4
1  foo     1     5
2  foo     2     4
3  foo     2     5

Here is how it should be (replaced second 'foo' with 'bar':

screenshot from 2016-04-29 14-49-45

@DavidDobr DavidDobr changed the title TYPO: "10 Minutes to pandas" TYPO: "10 Minutes to pandas" #mimimumeffort Apr 29, 2016
@DavidDobr DavidDobr changed the title TYPO: "10 Minutes to pandas" #mimimumeffort TYPO: "10 Minutes to pandas" Apr 29, 2016
@jreback
Copy link
Contributor

jreback commented Apr 29, 2016

@DavidDobr this is not a mistake, but probably a common case. You can certainly add to this to show the example with foo & bar.

@jreback jreback added Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode Difficulty Novice labels Apr 29, 2016
@jreback jreback added this to the Next Major Release milestone Apr 29, 2016
@jreback jreback changed the title TYPO: "10 Minutes to pandas" DOC: additional join examples in "10 Minutes to pandas" Apr 29, 2016
@jreback jreback modified the milestones: 0.18.2, Next Major Release May 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants