I have this example columns
year_short
89
99
97
87
98
00
02
05
10
11
20
22
what I want to do is to make that column into like this
year_long
1989
1999
1997
1987
1998
2000
2002
2005
2010
2011
2020
2022
is it possible to make like that ?
You could use the logic that any two digit year which is less than 25 belongs to the 2000
century, while any value greater than or equal to 25 belongs to the 1900
century:
df["year_long"] = np.where(df["year_short"] < 25, 2000 + df["year_short"], 1900 + df["year_short"])