Daily Dose of Data Science

Share this post

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com

Discover more from Daily Dose of Data Science

High-quality insights on Data Science and Python, along with best practices — shared daily. Get a 550+ Page Data Science PDF Guide and 450+ Practice Questions Notebook, FREE.
Over 37,000 subscribers
Continue reading
Sign in

Are You Sure You Are Using The Correct Pandas Terminologies?

If not, let's revisit.

Avi Chawla
Mar 26, 2023
21
Share this post

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com
2
Share

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
Share this post

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com
2
Share
Previous
Next
2 Comments
Share this discussion

Are You Sure You Are Using The Correct Pandas Terminologies?

www.blog.dailydoseofds.com
Lucas Nobre Barbosa
Mar 27Liked by Avi Chawla

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

Expand full comment
Reply
Share
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