0
0
Data Analysis Pythondata~30 mins

Why combining datasets creates complete pictures in Data Analysis Python - See It in Action

Choose your learning style9 modes available
Why combining datasets creates complete pictures
📖 Scenario: Imagine you work at a small bookstore. You have two lists: one with book titles and their authors, and another with book titles and their prices. To understand your inventory better, you want to combine these lists to see each book's title, author, and price together.
🎯 Goal: Build a combined dataset that shows each book's title, author, and price by joining two separate datasets.
📋 What You'll Learn
Create a dictionary called books_authors with book titles as keys and authors as values.
Create a dictionary called books_prices with book titles as keys and prices as values.
Create a list of dictionaries called combined_books where each dictionary has keys title, author, and price.
Print the combined_books list to show the complete picture.
💡 Why This Matters
🌍 Real World
Combining datasets helps businesses see all related information in one place, like matching customer info with their orders.
💼 Career
Data analysts often combine data from different sources to create reports and insights that help companies make decisions.
Progress0 / 4 steps
1
Create the books and authors dataset
Create a dictionary called books_authors with these exact entries: 'The Hobbit': 'J.R.R. Tolkien', '1984': 'George Orwell', 'Pride and Prejudice': 'Jane Austen'.
Data Analysis Python
Hint

Use curly braces {} to create a dictionary with book titles as keys and authors as values.

2
Create the books and prices dataset
Create a dictionary called books_prices with these exact entries: 'The Hobbit': 15.99, '1984': 12.50, 'Pride and Prejudice': 9.99.
Data Analysis Python
Hint

Use curly braces {} to create a dictionary with book titles as keys and prices as values.

3
Combine the datasets into one list
Create a list called combined_books that contains dictionaries for each book. Each dictionary should have keys 'title', 'author', and 'price'. Use a for loop with variables title and author to iterate over books_authors.items() and get the price from books_prices.
Data Analysis Python
Hint

Use a for loop to go through books_authors. For each book, get the price from books_prices and add a dictionary to combined_books.

4
Print the combined dataset
Write a print statement to display the combined_books list.
Data Analysis Python
Hint

Use print(combined_books) to show the final combined list.