Deleting a Dataframe Row based on a Column Value (StackOverFlow)

df = df[df.column_name != 0]

Creating a Column Using a DataFrame.Apply That Uses Multiple Conditions From Other Columns (StackOverFlow)

def conditions(s):
    if (s['discount'] > 20) or (s['tax'] == 0) or (s['total'] > 100):
        return 1
    else:
        return 0

# Add new column with
df_full['Class'] = df_full.apply(conditions, axis=1)

By Tony

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.