Cross-tabulation with crosstab()
📖 Scenario: You work in a small bookstore. You have data about customers' favorite book genres and their preferred reading time (Morning, Afternoon, Evening). You want to understand how many customers prefer each genre at different times of the day.
🎯 Goal: Create a cross-tabulation table using pandas.crosstab() to show the count of customers for each combination of Genre and ReadingTime.
📋 What You'll Learn
Create a pandas DataFrame with the exact data provided.
Create a variable for the column names to use in crosstab.
Use pandas.crosstab() with the specified columns.
Print the resulting cross-tabulation table.
💡 Why This Matters
🌍 Real World
Cross-tabulation helps businesses understand relationships between categories, like customer preferences by time or location.
💼 Career
Data analysts and scientists use crosstab to summarize and explore categorical data quickly for reports and decision-making.
Progress0 / 4 steps