0
0
Data Analysis Pythondata~15 mins

Why DataFrame is the core data structure in Data Analysis Python - See It in Action

Choose your learning style9 modes available
Why DataFrame is the core data structure
📖 Scenario: Imagine you work in a small store. You have a list of products, their prices, and how many you sold each day. You want to organize this information so you can easily see and analyze it.
🎯 Goal: You will create a simple table using a DataFrame to hold product sales data. Then, you will add a rule to find products with sales above a certain number. Finally, you will list those products and their sales.
📋 What You'll Learn
Create a DataFrame with product names, prices, and sales
Create a variable for the sales threshold
Use a filter to find products with sales above the threshold
Print the filtered DataFrame
💡 Why This Matters
🌍 Real World
Stores and businesses use tables like DataFrames to keep track of products, prices, and sales to make smart decisions.
💼 Career
Data scientists and analysts use DataFrames daily to clean, explore, and analyze data quickly and clearly.
Progress0 / 4 steps
1
Create the sales data DataFrame
Import pandas as pd and create a DataFrame called sales_data with these exact columns and values: Product with ['Apple', 'Banana', 'Carrot'], Price with [0.5, 0.3, 0.2], and Sales with [30, 45, 25].
Data Analysis Python
Need a hint?

Use pd.DataFrame with a dictionary where keys are column names and values are lists of data.

2
Set the sales threshold
Create a variable called sales_threshold and set it to 30.
Data Analysis Python
Need a hint?

Just create a variable and assign the number 30 to it.

3
Filter products with sales above the threshold
Create a new DataFrame called top_sellers by filtering sales_data to include only rows where the Sales column is greater than sales_threshold.
Data Analysis Python
Need a hint?

Use sales_data[condition] where condition checks if Sales is greater than sales_threshold.

4
Print the filtered top sellers
Print the top_sellers DataFrame to show products with sales above the threshold.
Data Analysis Python
Need a hint?

Use print(top_sellers) to show the filtered table.