Skip to content

DOC: Add example of skipcols in read_csv #15052

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

Merged

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Jan 4, 2017

Illustrate how we can use the usecols argument to skip particular columns.

Closes #10882.

@codecov-io
Copy link

codecov-io commented Jan 4, 2017

Current coverage is 84.75% (diff: 100%)

Merging #15052 into master will not change coverage

@@             master     #15052   diff @@
==========================================
  Files           145        145          
  Lines         51146      51146          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43351      43351          
  Misses         7795       7795          
  Partials          0          0          

Powered by Codecov. Last update 018414e...ea3279f

use in the final result:

.. ipython:: python
pd.read_csv(StringIO(data), usecols=lambda x: x.upper() not in ['A', 'C'])
Copy link
Member

Choose a reason for hiding this comment

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

I would simply do x: x not in ['a', 'c'] here, to focus on the applications of skipping the listed cols (the upper is already in the example above).

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense. Done.

@jorisvandenbossche jorisvandenbossche added Docs IO CSV read_csv, to_csv labels Jan 4, 2017
@jorisvandenbossche jorisvandenbossche added this to the 0.20.0 milestone Jan 4, 2017
Illustrate how we can use the "usecols"
argument to skip particular columns.

Closes pandas-devgh-10882.
@gfyoung gfyoung force-pushed the skipcols-usecols-doc branch from bea6137 to ea3279f Compare January 4, 2017 18:40
@jorisvandenbossche jorisvandenbossche merged commit 4de5cdc into pandas-dev:master Jan 4, 2017
@jorisvandenbossche
Copy link
Member

@gfyoung Thanks!

@gfyoung gfyoung deleted the skipcols-usecols-doc branch January 4, 2017 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants