Skip to main content

Includes functions to manipulate adwords datasets

Project description

el

Includes functions to manipulate adwords datasets

To install: pip install el

Features

This package provides essential tools for analyzing and managing advertising campaigns, particularly focusing on budget pacing and anomaly detection in spending data. Below are the main functionalities provided:

1. Budget Pacing Calculation

The calculate_budget_pacing function calculates how a budget should be spent over a campaign period to ensure even distribution of funds. It adds columns for daily budget, cumulative budget, and pacing to the DataFrame.

Usage

import pandas as pd
from el import calculate_budget_pacing

# Example DataFrame
df = pd.DataFrame({
    'date': pd.to_datetime(['2021-01-01', '2021-01-02']),
    'total_budget': [1000, 1000],
    'current_spend': [100, 300]
})

# Calculate budget pacing
result = calculate_budget_pacing(df, 'total_budget', 'current_spend', 'date', 30)
print(result)

2. Anomaly Detection in Spend

The detect_anomalies_in_spend function identifies anomalies in spending data using a rolling Z-score method. It considers fluctuations in spending over a specified window and marks those that deviate significantly from the norm.

Usage

import pandas as pd
from el import detect_anomalies_in_spend

# Example DataFrame
df = pd.DataFrame({
    'date': pd.to_datetime(['2021-01-01', '2021-01-02', '2021-01-03', '2021-01-04', '2021-01-05']),
    'spend': [100, 150, 200, 1200, 180]
})

# Detect anomalies in spending
result = detect_anomalies_in_spend(df, 'spend')
print(result)

Documentation

Functions

calculate_budget_pacing(df, budget_col, spend_col, date_col, total_days)

  • Parameters:
    • df (pd.DataFrame): DataFrame containing the campaign data.
    • budget_col (str): Column name for the total budget.
    • spend_col (str): Column name for the current spend.
    • date_col (str): Column name for the date of the spend.
    • total_days (int): Total number of days in the campaign period.
  • Returns:
    • pd.DataFrame: DataFrame with additional columns for daily budget, cumulative budget, and pacing.

detect_anomalies_in_spend(df, spend_col, window=7, z_threshold=3)

  • Parameters:
    • df (pd.DataFrame): DataFrame containing the spend data.
    • spend_col (str): Column name for the spend data.
    • window (int): Number of days to consider for the rolling mean and standard deviation.
    • z_threshold (float): Z-score threshold to identify an anomaly.
  • Returns:
    • pd.DataFrame: DataFrame with an additional column indicating if the spend is an anomaly.

These tools are designed to help advertisers and marketers optimize their campaigns and detect any irregularities in their spending patterns efficiently.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

el-0.0.6.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

el-0.0.6-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file el-0.0.6.tar.gz.

File metadata

  • Download URL: el-0.0.6.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for el-0.0.6.tar.gz
Algorithm Hash digest
SHA256 6d1ae4b98b9762f00bc33f54ee96bb8e36c57431a7467a14a7de10af8d00e019
MD5 1f7690927178808e0c4f4a87324088b8
BLAKE2b-256 19241a61a076ac1c62f1c8b859a7812d3b305272b9b4f67408babaa1b5ce98a0

See more details on using hashes here.

File details

Details for the file el-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: el-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for el-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ac37a11f47f30c939b68007a58c40e244b25387012c61eb14efd749f0b76fad0
MD5 8ca17450f5da377a48a97796b908ef85
BLAKE2b-256 3635869618259eb2e4a92f098eed27a4f1250442af538fe186160dcaa1d4bd94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page