📜  在数据框 python 代码示例中为年份创建列

📅  最后修改于: 2022-03-11 14:45:37.025000             🧑  作者: Mango

代码示例1
#Create column in df called 'Year' which extracts the year from the 'Date' column
data['Year'] = (data['Date']).dt.to_period('A')