how to get hours in dt pandas code example Example: taking hour information from time in pandas sales['datehour'] = sales['date'].dt.hour