核心是应用 pd.Series, 具体操作如下:
import pandas as pd
data = {'years': [2025],
'week': [{f"week_{i}": i for i in range(3)}]
}
df = pd.DataFrame(data)
print(df)
df = pd.concat([df, df['week'].apply(pd.Series)], axis=1).drop('week', axis=1)
print(df)