Python Create New Variable Based On Condition In Sql