Skip to main content

Includes functions to diagnose duplicates in adwords elements

Project description

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.

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

iy-0.0.6.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

iy-0.0.6-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for iy-0.0.6.tar.gz
Algorithm Hash digest
SHA256 df6299d62ae557af655543b53d001542523fe13795eb8eeed797706031edd3ae
MD5 02b6959bed2f13acead779a739f7a0a3
BLAKE2b-256 584b2be0be16a5933be492c728329ee9e7e09514c479d07620576dcc0b82078c

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for iy-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 19419381cfc52eadeae16f1dea6243a1ba9806bca13d0cbf68d6355ec38e1f70
MD5 d49a4e7c455e91888436f7b1d6b2c23a
BLAKE2b-256 e37a622000856ddc6cf0910766cdfafd397cf8c84d278c8dc0c516675c762763

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