Skip to main content

iy

Includes functions to diagnose duplicates in adwords elements

To install: pip install iy

Overview

The iy package provides a suite of tools designed to help diagnose and manage duplicate entries in AdWords campaigns. It includes functions for identifying duplicates based on various criteria such as keyword text transformations (stripping, lowercasing, ASCII conversion) and grouping by attributes like match type, ad group, or campaign. The package leverages pandas and numpy for data manipulation and analysis, ensuring efficient processing of large datasets.

Main Features

  • Keyword Duplicate Diagnosis: Identify duplicate keywords in your AdWords data, allowing for different levels of text normalization (e.g., stripping whitespace, converting to lowercase, ASCII encoding).
  • Statistical Analysis: Generate statistics about duplicates, including counts and ratios of duplicates, which can be broken down by type (e.g., exact, stripped, lowercase).
  • Grouping and Aggregation: Group data by specified keys and calculate duplication metrics for these groups.
  • Unicode Handling: Convert all keyword strings to Unicode to ensure consistency in text processing.

Usage Examples

Diagnosing Keyword Duplicates

To diagnose duplicates in a DataFrame containing AdWords data, you can use the kw_dup_diagnosis function. This function allows customization of grouping keys and duplication definitions.

import pandas as pd
from iy import kw_dup_diagnosis

# Sample DataFrame
data = {
    'keyword': ['example', 'example ', 'Example', 'sample', 'sample'],
    'match_type': ['Exact', 'Exact', 'Broad', 'Broad', 'Exact'],
    'ad_group': ['Group1', 'Group1', 'Group2', 'Group1', 'Group2'],
    'campaign': ['Campaign1', 'Campaign1', 'Campaign1', 'Campaign2', 'Campaign2']
}
df = pd.DataFrame(data)

# Diagnose duplicates
dup_info = kw_dup_diagnosis(df)
print(dup_info)

Generating Statistics for Duplicate Diagnosis

After diagnosing duplicates, you may want to generate general statistics to understand the extent of duplication:

from iy import general_stats_for_dup_diag

# Assuming `dup_info` is obtained from `kw_dup_diagnosis`
stats = general_stats_for_dup_diag(dup_info)
print(stats)

Advanced Duplicate Handling

For more complex scenarios, such as handling different types of duplicates across multiple dimensions (e.g., campaign and ad group), you can use the get_kw_duplicates_01 function:

from iy import get_kw_duplicates_01

# Get keyword duplicates with specific definitions
dup_details = get_kw_duplicates_01(df, dup_def='kw_lower', gr_keys=['match_type', 'ad_group', 'campaign'])
print(dup_details)

Function Documentation

  • kw_dup_diagnosis(df, grp_keys, grp_fun_dict, grp_id_name, grp_id_type, output_nondup_df): Analyzes a DataFrame for keyword duplicates based on specified grouping keys and duplication definitions. It returns a DataFrame with duplication information or optionally a tuple containing both the DataFrame with duplicates and the DataFrame without duplicates.

  • general_stats_for_dup_diag(diag_df, n_taps, n_broad_taps, dup_types): Computes and returns a dictionary of statistics about duplicates in the provided DataFrame. It can return the statistics along with the diagnostic DataFrame if the input DataFrame was not pre-diagnosed.

  • get_kw_duplicates_01(df, dup_def, gr_keys): An older function for obtaining keyword duplicates based on a specified definition of duplication (e.g., lowercased keywords). It supports merging results from different duplication criteria.

These functions are designed to be flexible and integrate easily into data processing pipelines for digital marketing analysis, especially for managing and optimizing Google AdWords campaigns.

Metadata

Release files for iy 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iy 0.0.7
File Size Uploaded
iy-0.0.7.tar.gz 9.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for iy 0.0.7
File Interpreter ABI Platform
iy-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / iy-0.0.7.tar.gz

Download URL iy-0.0.7.tar.gz
Size 9.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c9a70de55724447e83de0ec94ab58cc39561edfc90c8cc51dd2eff8b269da9e9
BLAKE2b-256 checksum
How to use checksums
6c3aa49dea013ee30337b5957d5d5b941adb47349dbea0d4f083262d76c80f71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / iy-0.0.7-py3-none-any.whl

Download URL iy-0.0.7-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aad8e7384627aadac38ab243032f146bc232c5f28d26879adb857daf0518a4d7
BLAKE2b-256 checksum
How to use checksums
a5aa6ca2f9dfc0ae07f01f5323d53ed2cbe9b8e5e9c1838a08c04cefc96a7420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page