Let's say I have a very simple dataframe with one column, year.
There would be 14 distinct years, from 2010 to 2023.
I would need to bin/bucket these years into three categories, 'old', 'medium', and 'new' where new would be the 3 most recent years (2023,2022,2021), medium would be 2015-2020, and old would be 2010-2014.
How would I do this?
source https://stackoverflow.com/questions/75203610/how-can-i-bucket-bin-a-dataframe-in-python-based-on-the-year
Comments
Post a Comment