# coding=utf-8
import pandas as pd
import json
# JSON字符串
json_str = '''
[
{"year": "2025-2", "name": "Alice", "age": 25, "city": "New York"},
{"year": "2025-3", "name": "Bob", "age": 30, "city": "Los Angeles"},
{"year": "2025-4", "name": "Charlie", "age": 35, "city": "Chicago"}
]
'''
json_data=json.loads(json_str)
df = pd.DataFrame(json_data)
df = df.set_index('year')
print(df)
print(df.to_dict())