Nowadays, I am extensively learning about dataframes
and analysis of these dataframes
using Python and I got stuck in a problem where I want to extract certain rows of the dataframe
based on a single condition or multiple conditions. For example, in the dataset I have attached below, how can I extract all sales which are greater than 3000
and also from the month of January
?
| | Names | Month | Sales |
|---:|:--------------:|:-------:|:------:|
| 0 | Alice | Jan | 2700 |
| 1 | Charlie | Jan | 1800 |
| 2 | Bobby | Mar | 1500 |
| 3 | Noah | Feb | 2200 |
| 4 | Alice | Feb | 3100 |
| 5 | Oliver | Mar | 2900 |
| 6 | Noah | Jan | 2500 |
| 7 | Charlie | Mar | 3300 |
| 8 | Bobby | Jan | 3800 |
| 9 | Alice | Mar | 4000 |
| 10 | Oliver | Jan | 4600 |
| 11 | Oliver | Feb | 4300 |
| 12 | Charlie | Feb | 5000 |
| 13 | Bobby | Feb | 5600 |
| 14 | Noah | Mar | 5200 |
This was just an example question, can anyone help me understand how the selection of rows works? And how can I join multiple conditions and filter my dataframe
based on multiple columns? Please provide example codes using the same dataset or some other.