CBSE Class 12 Informatics Practices
Question 5 of 44
Data Handling using Pandas — Question 10
Back to all questionsprint(SHOP[SHOP.City == 'Delhi'])
Reason — The correct code print(SHOP[SHOP.City == 'Delhi']) filters the SHOP DataFrame to show only the rows where the City column is equal to 'Delhi'. It does this by creating a boolean mask SHOP.City == 'Delhi' that returns True for rows where the city is 'Delhi' and False otherwise, and then using this mask to select the corresponding rows from the original DataFrame using SHOP[]. The resulting DataFrame, which contains only the rows that match the condition, is then printed to the console.