SQL group by time interval plus variable name using Python

welcome to shbcf.ru