############################################################

DATASET

- Drop columns

#' Removes all columns with revenue less than 3000
df.drop(df[(df['revenue'] < 3000)].index, inplace=True)

#' Removes all columns with revenue more than 17000
df.drop(df[(df['revenue'] > 17000)].index, inplace=True)

- Split a value

#' Split a value in a column into two values or more for more granular analysis
#' E.G. Split Search campaigns by "branded" and "non branded"
#' Iterate over the dataset
def split_search_campaigns(df):
    for index, row in df.iterrows():
        #' For each row where Campaign type is Search and Campaign name contains "Branded" with no "No"
        if row['g_campaign_type'] == 'Search' and 'Branded' in row['g_campaign_name'] and not 'No' in row['g_campaign_name']:
            #' Change Campaign Type to google_brand
            gg.at[index, 'campaign_type_google'] = 'google_brand'
        elif row['g_campaign_type'] == 'Search':
            #' Otherwise to google_no_brand
            gg.at[index, 'g_campaign_type'] = 'google_no_brand'
    return df

- Automatic classification of variables

#' Iterate over the columns of the dataset
#' Extraction of all columns with the word 'spend'
spend_columns = [col for col in df.columns if 'spend' in col]

- Cast type variable

#' Cast certain variables to the type you need
df[column] = df[column].astype(cast_type)
