MISSION 344

Combining Data With Pandas

In the lesson on aggregating data with Python, we worked with just one data set, the 2015 World Happiness Report, to explore data aggregation. However, it's very common in practice to work with more than one data set at a time.

Oftentimes, you'll find that you need additional data to perform analysis, or you'll find that you have the data, but need to pull it from multiple sources. In this mission, you'll learn a couple of different techniques for combining data using pandas to easily handle situations like these.

You'll use what you learned in the last mission to analyze 2015, 2016, and 2017 World Happiness Reports. Specifically, you'll look to answer the following question:

  • Did world happiness increase, decrease, or stay about the same from 2015 to 2017?

Just like in the last mission, you'll work with the World Happiness Report, an annual report created by the UN Sustainable Development Solutions Network with the intent of guiding policy. The report assigns each country a happiness score based on the answers to a poll question that asks respondents to rank their life on a scale of 0 to 10.

To perform this analysis, you’ll have to pull together multiple data sets, but we’ll show you how to combine data sets with pandas step-by-step in our interactive learning environment!

Objectives

  • Learn different techniques for combining data.
  • Learn about database-style joins and keys.

Mission Outline

1. Introduction
2. Combining Dataframes with the Concat Function
3. Combining Dataframes with the Concat Function Continued
4. Combining Dataframes with Different Shapes Using the Concat Function
5. Joining Dataframes with the Merge Function
6. Joining on Columns with the Merge Function
7. Left Joins with the Merge Function
8. Join on Index with the Merge Function
9. Challenge: Combine Data and Create a Visualization
10. Next steps
11. Takeaways

python-datacleaning

Course Info:

Beginner

The median completion time for this course is 7.2 hours. View Details

This course requires a basic subscription and includes five missions and one guided project.  It is the sixth course in the Data Analyst in Python path and Data Scientist in Python path.

START LEARNING FREE

Take a Look Inside