Skip to main content

TOPSIS-YourName-RollNumber

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

📋 Description

TOPSIS is a multi-criteria decision-making method that helps rank alternatives based on their similarity to the ideal solution. This package provides an easy-to-use implementation of the TOPSIS algorithm with comprehensive error handling and validation.

🎯 Features

  • ✅ Complete TOPSIS algorithm implementation
  • ✅ Command-line interface
  • ✅ Comprehensive input validation
  • ✅ Detailed error messages
  • ✅ CSV input/output support
  • ✅ Easy to use and integrate

📦 Installation

From PyPI

pip install Topsis-YourName-RollNumber

From Source

git clone https://github.com/yourusername/Topsis-YourName-RollNumber.git
cd Topsis-YourName-RollNumber
pip install -e .

🚀 Usage

Command Line

python -m Topsis-YourName-RollNumber <InputFile> <Weights> <Impacts> <OutputFile>

Example

python -m Topsis-YourName-RollNumber data.xlsx "1,1,1,2" "+,+,-,+" output.xlsx

As a Python Module

from Topsis_YourName_RollNumber import topsis_analysis

# Perform TOPSIS analysis
result_df = topsis_analysis(
    input_file='data.xlsx',
    weights='1,1,1,2',
    impacts='+,+,-,+',
    output_file='output.xlsx'
)

print(result_df)

📊 Input Format

Excel File Requirements (.xlsx)

  1. Minimum 3 columns: First column for alternatives (names), remaining columns for numeric criteria
  2. First column: Alternative names (non-numeric)
  3. Remaining columns: Numeric values only

Example Input File (data.xlsx)

Fund Name P1 P2 P3 P4 P5
M1 0.84 0.71 6.7 42.1 12.59
M2 0.91 0.83 7.0 31.7 10.11
M3 0.79 0.62 4.8 46.7 13.23
M4 0.78 0.61 6.4 42.4 12.55
M5 0.94 0.88 3.6 62.2 16.91

Parameters

  • Weights: Comma-separated numeric values (e.g., "1,1,1,2")
  • Impacts: Comma-separated + or - signs (e.g., "+,+,-,+")
    • + : Benefit criterion (higher is better)
    • - : Cost criterion (lower is better)

📤 Output Format

The output Excel file contains all input columns plus:

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

Example Output

Fund Name P1 P2 P3 P4 P5 Topsis Score Rank
M5 0.94 0.88 3.6 62.2 16.91 0.6890 1
M8 0.93 0.87 5.5 53.3 15.07 0.6123 2
... ... ... ... ... ... ... ...

⚠️ Error Handling

The package validates:

  • ✅ Correct number of arguments
  • ✅ File existence
  • ✅ Excel format (.xlsx)
  • ✅ Minimum 3 columns
  • ✅ Numeric values in criteria columns
  • ✅ Matching number of weights and criteria
  • ✅ Matching number of impacts and criteria
  • ✅ Valid impact signs (+ or -)
  • ✅ Proper comma separation

🧮 TOPSIS Algorithm Steps

  1. Normalize the decision matrix
  2. Apply weights to normalized matrix
  3. Identify ideal best and ideal worst solutions
  4. Calculate Euclidean distances from ideal solutions
  5. Compute TOPSIS score
  6. Rank alternatives

📚 Mathematical Formula

TOPSIS Score:

$$P_i = \frac{S_i^-}{S_i^+ + S_i^-}$$

Where:

  • $S_i^+$ = Distance from ideal best
  • $S_i^-$ = Distance from ideal worst

🛠️ Requirements

  • Python >= 3.7
  • pandas >= 1.0.0
  • numpy >= 1.18.0
  • openpyxl >= 3.0.0

📄 License

MIT License

👤 Author

Your Name

🤝 Contributing

Contributions, issues, and feature requests are welcome!

📝 Changelog

Version 1.0.0 (Initial Release)

  • Complete TOPSIS implementation
  • CLI interface
  • Comprehensive validation
  • PyPI package

Made with ❤️ for Multi-Criteria Decision Making

Metadata

Release files for Topsis-Vaibhavi-102303784 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-Vaibhavi-102303784 1.0.0
File Size Uploaded
topsis_vaibhavi_102303784-1.0.0.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Topsis-Vaibhavi-102303784 1.0.0
File Interpreter ABI Platform
topsis_vaibhavi_102303784-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.2 kB

Release files / topsis_vaibhavi_102303784-1.0.0.tar.gz

Download URL topsis_vaibhavi_102303784-1.0.0.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8beed2ee8835416d371388bbbca2b381fe7c8c12511db75e2d5956ae4e442f5f
BLAKE2b-256 checksum
How to use checksums
e98aa79423c2cc836637dac1dbeae7dc6c9db647d024e6d9cfdc961de8852940
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

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

Download URL topsis_vaibhavi_102303784-1.0.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a141e2a4e25178909bc055735224baccf93934f9528242916bd6fc71b6cc408
BLAKE2b-256 checksum
How to use checksums
18d96599ed0b5f1d6eebde222441be47023b84c46592b311ebf7a5a2166819eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

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