Exploring columns and index attributes in pandas DataFrame
📖 Scenario: You are working with sales data for a small store. You want to organize the data in a table format using pandas to easily see the products sold, their prices, and quantities.
🎯 Goal: Create a pandas DataFrame with sales data, then explore its columns and index attributes to understand the structure of the data.
📋 What You'll Learn
Create a pandas DataFrame named
sales_data with three columns: 'Product', 'Price', and 'Quantity'.Set the index of the DataFrame to be the product names.
Create a variable
cols that stores the column names of sales_data.Create a variable
idx that stores the index labels of sales_data.💡 Why This Matters
🌍 Real World
Organizing and exploring tabular data like sales records, inventory, or customer lists is common in many jobs.
💼 Career
Knowing how to use pandas DataFrames and their attributes helps in data analysis, reporting, and preparing data for machine learning.
Progress0 / 4 steps