Above you cast date_range as an int(), but here you're trying to use it to index into a dictionary with string keys.  Is this correct?