pradeepsf729 / pandas_101

Pandas questions with solutions
1 stars 0 forks source link

between #24

Open sandeepny441 opened 1 year ago

sandeepny441 commented 1 year ago

import pandas as pd

data = { 'Coffee_Shop': ['Brewed Awakening', 'Coffee Cloud', 'Bean Dream', 'Espresso Express', 'Latte Love', 'Mocha Magic', 'Cafe Comfort', 'Seattle Sip', 'Drip Drop', 'Grind Ground'], 'Location': ['Downtown', 'Capitol Hill', 'Green Lake', 'Ballard', 'West Seattle', 'Fremont', 'Queen Anne', 'Belltown', 'University District', 'Magnolia'], 'Avg_Rating': [4.5, 4.2, 5.0, 4.8, 4.6, 4.3, 4.9, 4.0, 4.7, 4.6], 'Coffee_Type': ['Espresso', 'Latte', 'Cappuccino', 'Americano', 'Cold Brew', 'Macchiato', 'Espresso', 'Latte', 'Drip Coffee', 'Americano'], 'Tables_Available': [5, 8, 6, 7, 5, 9, 7, 8, 6, 5] }

coffee_shops_df = pd.DataFrame(data)

  1. How would you use the between method to filter rows from the coffee_shops_df where Avg_Rating is between 4.5 and 5.0, inclusive?
  2. Which coffee shops from the DataFrame are located in areas between 'Ballard' and 'Fremont' alphabetically using the between method?
  3. How can you use the between method to identify coffee shops that have between 5 and 7 tables available?
  4. Is there a way to use the between method with dates? If so, how?