0
0
Pandasdata~15 mins

Creating Series from list and dictionary in Pandas - Try It Yourself

Choose your learning style9 modes available
Creating Series from list and dictionary
📖 Scenario: You work in a small shop that tracks daily sales. You want to organize sales data using pandas Series to analyze it easily.
🎯 Goal: Learn how to create pandas Series from a list and a dictionary, then display the results.
📋 What You'll Learn
Create a pandas Series from a list of sales numbers
Create a pandas Series from a dictionary of product sales
Print both Series to see the data
💡 Why This Matters
🌍 Real World
Organizing sales or measurement data in Series helps in quick analysis and visualization.
💼 Career
Data scientists and analysts often convert raw data into Series for easy manipulation and insights.
Progress0 / 4 steps
1
Create a pandas Series from a list
Import pandas as pd. Create a list called daily_sales with these exact values: 100, 150, 200, 130, 170. Then create a pandas Series called sales_series from the daily_sales list.
Pandas
Need a hint?

Use pd.Series() to convert a list into a Series.

2
Create a pandas Series from a dictionary
Create a dictionary called product_sales with these exact entries: 'Apples': 30, 'Bananas': 45, 'Oranges': 25. Then create a pandas Series called product_series from the product_sales dictionary.
Pandas
Need a hint?

Use pd.Series() with a dictionary to create a Series with labels.

3
Print both Series to see the data
Use two print() statements to display the sales_series and product_series.
Pandas
Need a hint?

Use print() to show the Series data.

4
Final output check
Run the program to see the printed Series from the list and dictionary.
Pandas
Need a hint?

The output shows the Series with index labels and values.