list comprehension pandas dataframe column code example
Example 1: comprehension list iloc pandas
df['Flag'] = ["High Bracket" if x > 70 else "Low Bracket" for x in df['prevsalary']]
Example 2: comprehension list iloc pandas
df['col2'] = [int(x) for x in df['col1']]