Topsis-Shweta-2004
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a multi-criteria decision-making method. This package implements TOPSIS in Python — it takes a decision matrix CSV, weights, and impacts, then returns a ranked result.
Installation
pip install Topsis-Shweta-2004
Usage
In Python:
from Topsis_Shweta_2004.topsis import topsis
topsis("data.csv", "1,1,1,2,1", "+,+,-,+,-", "result.csv")
Via Command Line:
python -m Topsis_Shweta_2004.topsis input.csv "1,1,1,2" "+,+,-,+" output.csv
Parameters:
| Parameter | Description |
|---|---|
input |
Path to input CSV file |
weights |
Comma-separated weights e.g. "1,1,2,1" |
impacts |
Comma-separated impacts e.g. "+,+,-,+" |
result |
Output CSV filename |
Input Format
First column = object/alternative name. Remaining columns = numeric criteria.
| Fund Name | P1 | P2 | P3 | P4 | P5 |
|---|---|---|---|---|---|
| M1 | 0.62 | 0.38 | 6.7 | 58.7 | 16.60 |
| M2 | 0.93 | 0.86 | 5.5 | 47.9 | 13.80 |
| M3 | 0.62 | 0.38 | 3.2 | 65.9 | 17.53 |
Output Format
Same as input with two additional columns: Topsis Score and Rank.
| Fund Name | P1 | P2 | P3 | P4 | P5 | Topsis Score | Rank |
|---|---|---|---|---|---|---|---|
| M1 | 0.62 | 0.38 | 6.7 | 58.7 | 16.60 | 0.3876 | 8.0 |
| M2 | 0.93 | 0.86 | 5.5 | 47.9 | 13.80 | 0.5213 | 4.0 |
How TOPSIS Works
- Normalize the decision matrix
- Apply weights to each criterion
- Find Ideal Best & Worst solutions
- Calculate distance from ideal best and worst
- Rank alternatives by closeness to ideal solution
Error Handling
- File not found → clear error message
- Mismatched weights/impacts/columns → ValueError
- Non-numeric values in criteria columns → ValueError
Requirements
- Python 3
- pandas
- numpy
License
(c) 2024 Shweta — MIT License
Release files for Topsis-Shweta-2004 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 | |
|---|---|---|---|
| topsis_shweta_2004-1.0.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| topsis_shweta_2004-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / topsis_shweta_2004-1.0.0.tar.gz
| Download URL | topsis_shweta_2004-1.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
74514dd93cd535a19035dd0a9e6dc1c50a8ca3af9a989d7c943e3b0c56003e8e
|
|
BLAKE2b-256 checksum How to use checksums |
97340d00285b9ea382c1d2191c9aab4c71af6cfa03787f44025c7072d48f682f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0rc2
|
Release files / topsis_shweta_2004-1.0.0-py3-none-any.whl
| Download URL | topsis_shweta_2004-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1085f09f7a909cbfb8f7ba137933b486858b4c8195508aedda01419f5ea8ae94
|
|
BLAKE2b-256 checksum How to use checksums |
5d5cf73a088381cca535b0167a615922f64941569733686f9c2657acb8bb6b01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0rc2
|