🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 23: City Weather Join

Data Analyst

Builds on these lessons

Current Task

Objective

.join() combines two DataFrames using their index rather than a named key column — convenient when both already share a meaningful index.

Task: join a temperature DataFrame with a humidity DataFrame, both indexed by city, and print the result.

index.py
import pandas as pd temps = pd.DataFrame({'temp_f': [72, 68]}, index=['NYC', 'LA']) humidity = pd.DataFrame({'humidity': [55, 40]}, index=['NYC', 'LA']) joined = temps.join(humidity) print(joined)

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview