Using apply() on DataFrame Columns with pandas
📖 Scenario: You work in a small store and have a table of products with their prices in dollars. You want to convert these prices to euros to see how much they cost in Europe.
🎯 Goal: You will create a pandas DataFrame with product names and prices in dollars. Then, you will use the apply() function on the price column to convert all prices to euros using a fixed exchange rate.
📋 What You'll Learn
Create a pandas DataFrame with product names and prices in dollars
Create a variable for the exchange rate from dollars to euros
Use
apply() on the price column to convert prices to eurosPrint the new column with prices in euros
💡 Why This Matters
🌍 Real World
Stores often need to convert prices between currencies to sell products internationally.
💼 Career
Data analysts use pandas apply() to quickly transform and clean data columns for reports and dashboards.
Progress0 / 4 steps