================================================================================
  Question 41: Join DataFrames with Matching Records From Both Sides (Inner Join)
================================================================================

FULL QUESTION:
Write a Pandas program to join the two data frames with matching records
from both sides, where available. (Same dataset as above.)

student_data1:
student_id | name             | marks
s1         | Danniella Fenton | 200
s2         | Ryder Storey     | 210
s3         | Bryce Jensen     | 190
s4         | Ed Bernal        | 222
s5         | Kwame Morin      | 199

student_data2:
student_id | name             | marks
s4         | Scarlette Fisher | 201
s5         | Carla Williamson | 200
s6         | Dante Morse      | 198
s7         | Kaiser William   | 219
s8         | Madeeha Preston  | 201

SHORT QUESTION:
Performs an inner merge on two student DataFrames to retrieve records with matching keys.

================================================================================
README & SETUP INSTRUCTIONS:
================================================================================
# Question 41: Join DataFrames with Matching Records From Both Sides (Inner Join)

- Prerequisites: Python 3.x, Pandas (pip install pandas).
- Setup: None.
- How to Run: python question_41.py
- Expected Behavior: Merges student_data1 and student_data2 on 'Student_Id' using how='inner'.

================================================================================
SOURCE CODE FILES:
================================================================================

1. question_41.py
--------------------------------------------------------------------------------
import pandas as pd

student_data1 = pd.DataFrame({
    'Student_Id': ['s1', 's2', 's3', 's4', 's5'],
    'Name': ['Danniella Fenton', 'Ryder Storey', 'Bryce Jensen', 'Ed Bernal', 'Kwame Morin'],
    'Marks': [200, 210, 190, 222, 199]
})

student_data2 = pd.DataFrame({
    'Student_Id': ['s4', 's5', 's6', 's7', 's8'],
    'Name': ['Scarlette Fisher', 'Carla Williamson', 'Dante Morse', 'Kaiser William', 'Madeeha Preston'],
    'Marks': [201, 200, 198, 219, 201]
})

combined_students = pd.concat([student_data1, student_data2], ignore_index=True)
combined_students['Student_Id'] = combined_students['Student_Id'].str.upper()

exam_data = pd.DataFrame({
    'Student_Id': ['S1', 'S2', 'S3', 'S4', 'S5', 'S7', 'S8', 'S9', 'S10', 'S11', 'S12', 'S13'],
    'Exam_Id': [23, 45, 12, 67, 21, 55, 33, 14, 56, 83, 88, 12]
})

full_outer_join = pd.merge(combined_students, exam_data, on='Student_Id', how='outer')

print("Full Outer Join (All Matching & Unmatched Records):")
print(full_outer_join)
--------------------------------------------------------------------------------
