Calculate Percentage Change Using pct_change()
📖 Scenario: You work in a small shop and track daily sales. You want to see how sales change day to day in percentage to understand growth or decline.
🎯 Goal: Build a small program that creates a sales data table, sets a configuration for percentage change periods, calculates the percentage change using pct_change(), and prints the result.
📋 What You'll Learn
Create a pandas DataFrame with daily sales data
Set a variable for the number of periods to calculate percentage change
Use the
pct_change() method with the periods variablePrint the resulting DataFrame with percentage changes
💡 Why This Matters
🌍 Real World
Tracking percentage change in sales helps businesses understand growth trends and make better decisions.
💼 Career
Data analysts and business intelligence professionals often calculate percentage changes to report performance metrics.
Progress0 / 4 steps