/mnt/data/ipykernel_11/3013686415.py:6: FutureWarning: ‘Y’ is deprecated and will be removed in a future version, please use ‘YE’ instead. ‘出生年份’: pd.date_range(start=‘1960-01-01’, end=‘2005-12-31’, freq=‘Y’),
NameError Traceback (most recent call last) Cell In[1], line 7 2 import matplotlib.pyplot as plt 4 # 创建出生年份与退休年龄的对照表 5 data = { 6 ‘出生年份’: pd.date_range(start=‘1960-01-01’, end=‘2005-12-31’, freq=‘Y’), ----> 7 ‘退休年龄’: [60 + (2026 - year.year) // 12 for year in data[‘出生年份’]] 8 } 10 df = pd.DataFrame(data) 12 # 绘制出生年份与退休年龄的对照图
NameError: name ‘data’ is not defined