Skip to content

DOC: More examples comparison with sql #12932

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

Conversation

maxu777
Copy link
Contributor

@maxu777 maxu777 commented Apr 20, 2016

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

added the following examples:

  • Top N rows with offset
  • Top N rows per group
  • ROW_NUMBER() OVER(PARTITION BY day ORDER BY total_bill DESC)
  • UPDATE
  • DELETE

@jreback
Copy link
Contributor

jreback commented Apr 20, 2016

pls don't close original PR's and open new ones, just push to the SAME one.

@jreback jreback added Docs IO SQL to_sql, read_sql, read_sql_query labels Apr 20, 2016
@jreback
Copy link
Contributor

jreback commented Apr 20, 2016

Contributing to pandas
======================

Where to start?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not part of your PR, pls remove

@maxu777
Copy link
Contributor Author

maxu777 commented Apr 20, 2016

sorry, i'm new to GitHub stuff - have to learn how to deal with that

@maxu777
Copy link
Contributor Author

maxu777 commented Apr 20, 2016

@jreback, how can i remove it?

@jreback
Copy link
Contributor

jreback commented Apr 20, 2016

just rebase on master

git rebase -i origin/master

@maxu777
Copy link
Contributor Author

maxu777 commented Apr 20, 2016

i either have this error message:

[pandas_dev] C:\Users\Max\Anaconda3\envs\pandas-maxu777\doc>git rebase -i origin/master

It seems that there is already a rebase-merge directory, and
I wonder if you are in the middle of another rebase. If that is the
case, please try
git rebase (--continue | --abort | --skip)
If that is not the case, please
rm -fr "C:/Users/Max/Anaconda3/envs/pandas-maxu777/.git/rebase-merge"
and run me again. I am stopping in case you still have something
valuable there.

or that:

[pandas_dev] C:\Users\Max\Anaconda3\envs\pandas-maxu777\doc>git commit -m "restored original CONTRIBUTING.md"
interactive rebase in progress; onto 2267bd3
fatal: Could not open file .git/rebase-merge/done for reading: No such file or directory

i'm giving up - unfortunately i don't have that much time to play with git
:(

@jreback
Copy link
Contributor

jreback commented Apr 20, 2016

git rebase --abort

then try again

@jreback
Copy link
Contributor

jreback commented Apr 20, 2016

http://stackoverflow.com/questions/2047465/how-can-i-delete-a-file-from-git-repo

you can also do (you need to do the abort though)

git rm contributing.MD --cached

@maxu777
Copy link
Contributor Author

maxu777 commented Apr 20, 2016

@jreback, i've pushed it now - is it OK now?

@maxu777 maxu777 changed the title More examples comparison with sql DOC: More examples comparison with sql Apr 20, 2016
@jreback
Copy link
Contributor

jreback commented Apr 20, 2016

not sure what you have pushed here, but doesn't look like its updated according to my comments.

@maxu777 maxu777 force-pushed the more_examples__comparison_with_sql branch from 780ded2 to b32738b Compare April 20, 2016 22:16
@maxu777
Copy link
Contributor Author

maxu777 commented Apr 22, 2016

@jreback, is it OK now?

@@ -109,9 +109,9 @@ For a python 3 environment:

conda create -n pandas_dev python=3 --file ci/requirements_dev.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file should be removed, but if you can't i will do on merge

@jreback jreback added this to the 0.18.1 milestone Apr 22, 2016
@jreback
Copy link
Contributor

jreback commented Apr 22, 2016

any comments from those SQL inclined


.. ipython:: python

tips.sort_values(['total_bill'], ascending=False).groupby('sex').head(3)
Copy link
Contributor

@jreback jreback Apr 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

show these with chained method syntax e.g.

(tips.sort_values(['total_bill'], ascending=False)
     .groupby('sex')
     .head(3)
)

@codecov-io
Copy link

codecov-io commented Apr 27, 2016

Current coverage is 83.91%

Merging #12932 into master will increase coverage by +0.08%

@@           master     #12932   diff @@
========================================
  Files         135        136     +1   
  Lines       49664      49918   +254   
  Methods         0          0          
  Branches        0          0          
========================================
+ Hits        41610      41885   +275   
+ Misses       8054       8033    -21   
  Partials        0          0          
  1. 5 files in pandas/tseries were modified. more
    • Misses +9
    • Hits +108
  2. 2 files in pandas/tools were modified. more
    • Misses +1
    • Hits +50
  3. 3 files in pandas/core were modified. more
    • Misses -2
    • Hits +2
  4. 3 files in pandas were modified. more
    • Misses -2
    • Hits +7
  5. File .../core/categorical.py (not in diff) was modified. more
    • Misses -1
    • Partials 0
    • Hits +1

Powered by Codecov. Last updated by d49cb5a

@TomAugspurger
Copy link
Contributor

+1 on the SQL docs.

tips.loc[tips['rn'] < 3].sort_values(['day','rn'])

the same using `rank(method='first')` function

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(tips.assign(rn=tips.sort_values(['total_bill'], ascending=False)
                    .groupby(['day'])
                    .cumcount() + 1)
     .query('rn < 3')
)

@maxu777
Copy link
Contributor Author

maxu777 commented Apr 28, 2016

@jreback, thanks for the hint: assign().query() - i wasn't aware of assign() function

@jreback jreback closed this in a614788 Apr 28, 2016
@jreback
Copy link
Contributor

jreback commented Apr 28, 2016

thanks!

FYI, I think somehow the CONTRIBUTING.md file got moved to .github/CONTRIBUTING.md; that's why it showed up. I removed that change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs IO SQL to_sql, read_sql, read_sql_query
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants