Skip to main content

Topsis-Lakshita-102303505

PyPI version Python 3.7+ License: MIT

TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) - A Python package for multi-criteria decision analysis.

What is TOPSIS?

TOPSIS is a multi-criteria decision analysis method that identifies the alternative closest to the ideal solution and farthest from the negative-ideal solution. The ideal solution maximizes benefit criteria and minimizes cost criteria.

Installation

pip install Topsis-Lakshita-102303505

Usage

Command Line

topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>

Examples

# Example 1: Equal weights, all positive impacts
topsis data.csv "1,1,1,1,1" "+,+,+,+,+" output.csv

# Example 2: Different weights, mixed impacts
topsis data.csv "2,1,3,1,2" "+,+,-,+,+" results.csv

# Example 3: Using Excel file
topsis data.xlsx "1,1,1,2" "+,+,-,+" output.csv

Python API

from Topsis_Lakshita_102303505 import topsis_analysis

result_df = topsis_analysis(
    input_file='data.csv',
    weights='1,1,1,2',
    impacts='+,+,-,+',
    output_file='output.csv'
)

print(result_df)

Input File Format

The input file (CSV or Excel) must have:

  • At least 3 columns: 1 name column + 2 or more criteria columns
  • First column: Alternative names (text)
  • Remaining columns: Numeric criteria values only

Example:

Model Price Storage Camera Looks
M1 250 16 12 5
M2 200 16 8 3
M3 300 32 16 4

Parameters

  • Weights: Comma-separated numeric values (e.g., "1,1,1,2")

    • Must match the number of criteria columns
  • Impacts: Comma-separated + or - signs (e.g., "+,+,-,+")

    • + for beneficial criteria (higher is better)
    • - for cost criteria (lower is better)
    • Must match the number of criteria columns

Output

The output CSV file contains all original columns plus:

  • Topsis Score: Performance score (0-1 range, higher is better)
  • Rank: Integer ranking (1 = best alternative)

Example Output:

Model Price Storage Camera Looks Topsis Score Rank
M3 300 32 16 4 0.691 1
M1 250 16 12 5 0.534 2
M2 200 16 8 3 0.308 3

Error Handling

The package validates:

  • ✅ File existence
  • ✅ Minimum 3 columns
  • ✅ Numeric values in criteria columns
  • ✅ Matching counts of weights, impacts, and criteria
  • ✅ Valid impact signs (+ or -)
  • ✅ Proper comma separation

Algorithm Steps

  1. Normalize the decision matrix using vector normalization
  2. Apply weights to normalized values
  3. Identify ideal solutions (best and worst)
  4. Calculate Euclidean distances from ideal solutions
  5. Compute performance scores
  6. Rank alternatives based on scores

Dependencies

  • pandas >= 1.0.0
  • numpy >= 1.18.0
  • openpyxl >= 3.0.0 (for Excel support)

License

MIT License - See LICENSE file for details

Author

Lakshita Gupta
Email: lakshitagupta0518@gmail.com
Roll Number: 102303505

Version

1.0.0 (2026-01-20)

  • Initial release
  • TOPSIS algorithm implementation
  • CSV and Excel file support
  • Command-line interface
  • Python API
  • Comprehensive error handling

For detailed documentation, examples, and troubleshooting, visit the GitHub repository.

Metadata

Release files for Topsis-Lakshita-102303505 1.0.0

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

Source distribution (sdist)

Source distribution for Topsis-Lakshita-102303505 1.0.0
File Size Uploaded
topsis_lakshita_102303505-1.0.0.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Topsis-Lakshita-102303505 1.0.0
File Interpreter ABI Platform
topsis_lakshita_102303505-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.1 kB

Release files / topsis_lakshita_102303505-1.0.0.tar.gz

Download URL topsis_lakshita_102303505-1.0.0.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
69bdb5e6877e0e2961b53b9d8fe08d92243118ea3747fd805f87637ba08761b2
BLAKE2b-256 checksum
How to use checksums
ac368c122db12f1ef7ce50860ebfdf2a67d7c2a9872a76bd6960db6e70c0562f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / topsis_lakshita_102303505-1.0.0-py3-none-any.whl

Download URL topsis_lakshita_102303505-1.0.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3091bc3117532a062b9891a50ec1601c70965e80369095b7a3498400b68b30b5
BLAKE2b-256 checksum
How to use checksums
37b4bdb28c38ff079cad8039c8a4d5ad9b2107908bc39f71adc2f57567f0d8a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

1.0.0 This release

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