Are You Sure You Are Using The Correct Pandas Terminologies?

If not, let's revisit.

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.

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.

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

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

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 :)

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

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

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.

Reply

or to participate.