Using conditional to generate new column in pandas dataframe
You can define a function which returns your different states “Full”, “Partial”, “Empty”, etc and then use df.apply to apply the function to each row. Note that you have to pass the keyword argument axis=1 to ensure that it applies the function to rows. import pandas as pd def alert(row): if row[‘used’] == 1.0: return … Read more