Daily Dose of Data Science

Share this post

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com

Are You Sure You Are Using The Correct Pandas Terminologies?

If not, let's revisit.

Avi Chawla
Mar 26, 2023
21
2
Share
Share this post

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com

Many Pandas users use the dataframe subsetting terminologies incorrectly. So let's spend a minute to get it straight.

π’π”ππ’π„π“π“πˆππ† means extracting value(s) from a dataframe. This can be done in four ways:

1) We call it π’π„π‹π„π‚π“πˆππ† when we extract one or more of its π‚πŽπ‹π”πŒππ’ based on index location or name. The output contains some columns and all rows.

Selecting a dataframe

2) We call it π’π‹πˆπ‚πˆππ† when we extract one or more of its π‘πŽπ–π’ based on index location or name. The output contains some rows and all columns.

Slicing a dataframe

3) We call it πˆππƒπ„π—πˆππ† when we extract both π‘πŽπ–π’ and π‚πŽπ‹π”πŒππ’ based on index location or name.

Indexing a dataframe

4) We call it π…πˆπ‹π“π„π‘πˆππ† when we extract π‘πŽπ–π’ and π‚πŽπ‹π”πŒππ’ based on conditions.

Filtering a dataframe

Of course, there are many other ways you can perform these four operations.

Here’s a comprehensive Pandas guide I prepared once: Pandas Map. Please refer to the β€œDF Subset” branch to read about various subsetting methods :)

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new about Python and Data Science every day.

πŸ‘‰ Tell me you liked this post by leaving a heart react 🀍.

πŸ‘‰ If you love reading this newsletter, feel free to share it with friends!

Share Daily Dose of Data Science


Find the code for my tips here:Β GitHub.

I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn and Twitter.

21
2
Share
Share this post

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com
Previous
Next
2 Comments
Lucas Nobre Barbosa
Mar 27Liked by Avi Chawla

This is some content that we don't see everywhere. Excellent text!

Expand full comment
Reply
1 reply by Avi Chawla
1 more comment…
Top
New
Community

No posts

Ready for more?

Β© 2023 Avi Chawla
Privacy βˆ™ Terms βˆ™ Collection notice
Start WritingGet the app
SubstackΒ is the home for great writing