I've created several objects named 'Student' in python. Each object has attributes containing information like age, name, and gender. Besides, each object has a dataframe, which is a test grade of a student in this year. I want to merge these dataframes and get a nested table without losing their personal information. Here's the python code:
import pandas as pd
class Student:
def __init__(age, name, gender, dataframe):
self.age = age
self.name = name
self.gender = gender
self.grades = dataframe
...
A dataframe looks like this:
I want to get a nested table like this:

How can I do this using Pandas? Thanks a lot!
