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.
Release files for el 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| el-0.0.6.tar.gz | 11.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| el-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.0 kB
Release files / el-0.0.6.tar.gz
| Download URL | el-0.0.6.tar.gz |
|---|---|
| Size | 11.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6d1ae4b98b9762f00bc33f54ee96bb8e36c57431a7467a14a7de10af8d00e019
|
|
BLAKE2b-256 checksum How to use checksums |
19241a61a076ac1c62f1c8b859a7812d3b305272b9b4f67408babaa1b5ce98a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|
Release files / el-0.0.6-py3-none-any.whl
| Download URL | el-0.0.6-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ac37a11f47f30c939b68007a58c40e244b25387012c61eb14efd749f0b76fad0
|
|
BLAKE2b-256 checksum How to use checksums |
3635869618259eb2e4a92f098eed27a4f1250442af538fe186160dcaa1d4bd94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.13
|