A Python package for TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)
Project description
Topsis-vishesh-102316085
A Python package implementing TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) for multi-criteria decision making.
Description
TOPSIS is a multi-criteria decision analysis method. It helps in ranking alternatives based on their distance from the ideal solution. This package provides both a Python library and a command-line interface for performing TOPSIS analysis.
Installation
From PyPI (after publishing)
pip install Topsis-vishesh-102316085
From source
git clone https://github.com/yourusername/topsis.git
cd topsis
pip install .
Usage
Command Line
After installation, you can use the topsis command:
topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>
Example:
topsis data.csv "1,1,1,2" "+,+,-,+" output.csv
Parameters:
InputDataFile: Path to CSV file containing the decision matrix (first column should be alternative names)Weights: Comma-separated weights for each criterion (e.g., "1,1,1,2")Impacts: Comma-separated impacts for each criterion, either '+' (benefit) or '-' (cost) (e.g., "+,+,-,+")OutputResultFileName: Path where the result CSV will be saved
Python Library
from Topsis_vishesh_102316085 import topsis
# Perform TOPSIS analysis
result_df = topsis(
input_file='data.csv',
weights_str='1,1,1,2',
impacts_str='+,+,-,+',
output_file='output.csv'
)
print(result_df)
Input File Format
The input CSV file should have:
- First column: Names/IDs of alternatives
- Remaining columns: Numeric criteria values
Example (data.csv):
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
Output
The output CSV file will contain:
- All original columns
Topsis Score: Calculated TOPSIS score for each alternativeRank: Rank of each alternative (1 being the best)
Validation
The package performs comprehensive validation:
- Correct number of parameters
- File existence check
- Minimum 3 columns requirement
- Numeric values validation (from 2nd column onwards)
- Equal number of weights, impacts, and criteria
- Valid impact values (+ or -)
- Comma-separated format for weights and impacts
Sample Example
Reference implementation: https://pypi.org/project/topsis-3283/
License
MIT License
Author
Vishesh (Roll No: 102316085)
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_vishesh_102316085-1.0.0.tar.gz.
File metadata
- Download URL: topsis_vishesh_102316085-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb556f9015bc1a10df59902d7531f24bd157705e64418f72b9fddb62e62adb05
|
|
| MD5 |
9e88746830c985633dc046fba3c7f805
|
|
| BLAKE2b-256 |
fe4cc7c6d5cc90798a187b1f653058ac94fe4aa25a27b7f5bf1bdf4747a6c3d7
|
File details
Details for the file topsis_vishesh_102316085-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_vishesh_102316085-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
954eadc47b63f6d06577d0f41fbf8ee628d81366facea2fc3591ec33c12481fd
|
|
| MD5 |
5b563758238b6149e233396a86c9e6e3
|
|
| BLAKE2b-256 |
de1720c1a85e0d4b1ec030cc2a4c0320d1f9e6a844ddb56fc9fc73d17316f874
|