8000 GitHub - imf4isal/shelfgap: ShelfGap is a Python application that compares product catalogs between two retail chains to identify pricing gaps, availability differences, and product similarities. It uses fuzzy string matching to find products that are similar but have slight naming variations. · GitHub
[go: up one dir, main page]

Skip to content
imf4isalPublic

About

ShelfGap is a Python application that compares product catalogs between two retail chains to identify pricing gaps, availability differences, and product similarities. It uses fuzzy string matching to find products that are similar but have slight naming variations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ShelfGap - Product Comparison Tool

ShelfGap is a Python application that compares product catalogs between two retail chains to identify pricing gaps, availability differences, and product similarities. It uses fuzzy string matching to find products that are similar but have slight naming variations.

Features

  • Automated Product Matching: Compare product lists from two Excel files
  • Fuzzy String Matching: Uses RapidFuzz library to find similar products with configurable similarity thresholds
  • Detailed Reports: Generate comprehensive comparison reports with statistics
  • Multiple Match Categories:
    • Exact matches (identical product names)
    • Similar matches (with similarity percentages)
    • Products unique to each store
  • Flexible Input: Automatically detects the first column in Excel files as product names
  • Terminal & File Output: View results in terminal or save detailed reports to files

Installation

  1. Clone or download the repository
  2. Install required dependencies:
pip install -r requirements.txt

Dependencies

  • pandas>=1.3.0 - Data manipulation and Excel file handling
  • openpyxl>=3.0.0 - Excel file reading/writing support
  • rapidfuzz>=3.0.0 - Fast fuzzy string matching

Usage

Basic Usage

python compare.py file1.xlsx file2.xlsx

With Custom Output File

python compare.py file1.xlsx file2.xlsx --output custom_report.txt

Example

python compare.py data/mudi.tea.xlsx data/shwapno.tea.xlsx

This will:

  1. Load product lists from both Excel files
  2. Compare products using fuzzy matching (80% similarity threshold)
  3. Generate a report saved to reports/comparison.mudi.tea.shwapno.tea.txt
  4. Display summary results in the terminal

File Structure

shelfgap/
├── compare.py              # Main entry point and CLI interface
├── compare_products.py     # Core product matching algorithm
├── load_excel_column.py    # Excel file data loader
├── report_generator.py     # Report formatting and file output
├── create_test_data.py     # Sample data generator
├── requirements.txt        # Python dependencies
├── data/                   # Sample data files
│   ├── chain1_products.xlsx
│   ├── chain2_products.xlsx
│   ├── mudi.tea.xlsx
│   └── shwapno.tea.xlsx
└── reports/                # Generated comparison reports
    └── comparison.*.txt

How It Works

  1. Data Loading: Reads the first column from each Excel file as product names
  2. Exact Matching: Finds products with identical names (case-insensitive)
  3. Fuzzy Matching: Uses RapidFuzz to find similar products with ≥80% similarity
  4. Categorization: Groups results into exact matches, similar matches, and unique products
  5. Report Generation: Creates detailed text reports with timestamps and statistics

Sample Output

📊 COMPARISON RESULTS:
Exact matches: 5
Similar matches: 14
Only in mudi.tea.xlsx: 25
Only in shwapno.tea.xlsx: 18

🔍 SIMILAR MATCHES (14):
  1. Ispahani Blender's Choice Black Tea 200gm ≈ Ispahani Blenders Choice Tea 100gm (Bag) (81.48% match)
  2. Tetley Green Tea- Pure original (25 sachet) ≈ Tetley Green Tea Pure Original (25 Tea Bag) (83.72% match)
  ...

Configuration

The similarity threshold is set to 80% by default in compare_products.py:4. You can modify this value to make matching more or less strict:

def compare_products(products1, products2, threshold=80):

Use Cases

  • Retail Competition Analysis: Compare product offerings between competing stores
  • Inventory Management: Identify gaps in product catalogs
  • Market Research: Analyze product naming variations across retailers
  • Price Comparison Setup: Prepare data for price comparison tools
  • Supply Chain Analysis: Find common suppliers across different retailers

Contributing

This is a focused tool for product comparison analysis. When contributing:

  1. Maintain the existing code style and structure
  2. Test with various Excel file formats
  3. Ensure fuzzy matching accuracy for your use case
  4. Update documentation for any new features

License

This project is provided as-is for product comparison and analysis purposes.

About

ShelfGap is a Python application that compares product catalogs between two retail chains to identify pricing gaps, availability differences, and product similarities. It uses fuzzy string matching to find products that are similar but have slight naming variations.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0