def stream_half(col1, col2): if col1 == 'desktop': return col2/2 else: return int(col2) df['clean'] = df.apply(lambda row: stream_half(row['device'], row['streams']), axis = 1)