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)
- Minimum 3 columns: First column for alternatives (names), remaining columns for numeric criteria
- First column: Alternative names (non-numeric)
- 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
- Normalize the decision matrix
- Apply weights to normalized matrix
- Identify ideal best and ideal worst solutions
- Calculate Euclidean distances from ideal solutions
- Compute TOPSIS score
- 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
- Roll Number: Your Roll Number
- Email: your.email@example.com
- GitHub: @yourusername
🤝 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| topsis_vaibhavi_102303784-1.0.0.tar.gz | 6.6 kB | Without provenance | Details for topsis_vaibhavi_102303784-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| topsis_vaibhavi_102303784-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for topsis_vaibhavi_102303784-1.0.0-py3-none-any.whl |
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
|
Security for Topsis-Vaibhavi-102303784 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.