Pandas获取时间列的年、月、日 首先将时间列转化为时间格式 # 转化时间 df['购买日期'] = pd.to_datetime(df['购买日期'],format='%Y%m%d') 2. 单独获取月份列、年份列