how to extract year and month from date in python