A Python package implementing the TOPSIS method
Project description
🚀 TOPSIS – Python Package
Project Description
This package implements TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) using Python 🐍.
TOPSIS is a multi-criteria decision-making (MCDM) technique used to rank alternatives based on their distance from an ideal best solution and an ideal worst solution. The alternative closest to the ideal best and farthest from the ideal worst is considered the best option.
This package allows users to perform TOPSIS analysis easily and can be executed directly from the command line after installation.
Package Name
Topsis-Sameer-102303773
Installation
Install the package from PyPI using pip:
pip install Topsis-Sameer-102303773
Usage (Command Line)
Run the TOPSIS method using the following command:
topsis input.csv "1,1,1,2" "+,+,-,+" output.csv
Input File Format
The input file must be in CSV format.
The first column should contain the names of the alternatives.
The remaining columns should contain numeric values only.
A minimum of three columns is required.
Example input file:
Fund Name,P1,P2,P3,P4
M1,0.67,0.45,6.5,42.6
M2,0.60,0.36,3.6,53.3
M3,0.82,0.67,3.8,63.1
Weights and Impacts
Weights represent the importance of each criterion.
Impacts specify whether a criterion is beneficial or non-beneficial.
Use + if a higher value is better.
Use - if a lower value is better.
The number of weights and impacts must match the number of criteria columns.
Output File Format
The output is a CSV file containing all original columns along with:
Topsis Score – Relative closeness of each alternative to the ideal solution.
Rank – Ranking of alternatives based on the TOPSIS score.
A higher TOPSIS score indicates a better alternative.
Methodology
The TOPSIS algorithm follows these steps:
- Read the input data from the CSV file
- Normalize the decision matrix
- Apply weights to the normalized matrix
- Determine the ideal best and ideal worst values
- Calculate the distance from ideal solutions
- Compute the TOPSIS score
- Rank the alternatives based on the score
Error Handling
The package handles the following errors:
Incorrect number of command-line arguments
Input file not found
Non-numeric values in criteria columns
Mismatch between number of weights, impacts, and criteria
Invalid impact values (only + or - allowed)
Dependencies
Python 3.x
Pandas
NumPy
Conclusion
This package provides a simple and effective way to perform TOPSIS analysis using Python. It is suitable for academic assignments, projects, and real-world decision-making problems involving multiple criteria.
Happy Decision Making ✨
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file topsis_sameer_102303773-1.0.2.tar.gz.
File metadata
- Download URL: topsis_sameer_102303773-1.0.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d73eb15a1868c1f15fd87441e3c51f18af91405b1ef95cb145dde8a3e961c8fb
|
|
| MD5 |
8ec4dfec5e01b7bd0202aa40dd580a79
|
|
| BLAKE2b-256 |
be5a05d6902129b232798ae46c1d90785a49b4d6115fdd6d4790ebc72d478033
|
File details
Details for the file topsis_sameer_102303773-1.0.2-py3-none-any.whl.
File metadata
- Download URL: topsis_sameer_102303773-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bca3d993b9922e244f1d015611c95f6e99fc2ac9f346692901a86278b98f4b1
|
|
| MD5 |
d9705fd03f2fc6447836876f27cd9eae
|
|
| BLAKE2b-256 |
2755285be8672cd9266af95525c9ee4ae62ca1ced10e62c6deb88cb19cbb0c08
|