Observed since 20 Oct, 15:10 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
A Python package to implement TOPSIS
A Python package to implement TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) for multi-criteria decision analysis.
Author: Harsh Tanwar
Roll No: 102303812
Email: htanwar_be23@thapar.edu
Repository: Assignment1-Topsis
TOPSIS ranks alternatives by comparing each to an ideal positive and ideal negative solution. Alternatives closer to the ideal positive and farther from the ideal negative get higher scores and better ranks. The method uses vector normalization, weighted criteria, and Euclidean distances to compute a performance score for each alternative.
Install dependencies:
pip install pandas numpy
pip install 102303812-topsis
git clone https://github.com/htan11/course-materials.git
cd course-materials/UCS654/Assignment1-Topsis
pip install .
Or, in the folder containing setup.py:
pip install .
topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>
Example (with 5 criteria):
topsis data.csv "1,1,1,1,1" "+,+,-,+,-" result.csv
(Because the package name contains a hyphen, use importlib to import.)
import importlib
topsis = getattr(importlib.import_module("102303812-topsis"), "topsis")
topsis("data.csv", "1,1,1,1,1", "+,+,-,+,-", "result.csv")
| Parameter | Description |
|---|---|
| InputDataFile | Path to a CSV file: first column = alternative names, remaining columns = numeric criterion values. Must have a header row. |
| Weights | Comma-separated weights for each criterion (e.g. "1,1,1,2,1"). Number of values must match number of criteria. |
| Impacts | Comma-separated impacts: + for beneficial (higher is better), - for non-beneficial (lower is better). Same count as criteria. |
| OutputResultFileName | Path for the output CSV. Contains original columns plus Topsis Score and Rank. |
+): e.g. Quality, Customer Rating — higher value is better.-): e.g. Price, Delivery Time — lower value is better.CSV with a header; first column = alternative names, rest = numeric only.
Example (data.csv):
| Product | Quality | Price | Features | Customer Rating | Delivery Time |
|---|---|---|---|---|---|
| A1 | 8.5 | 450 | 7.2 | 4.3 | 3 |
| A2 | 7.8 | 380 | 8.1 | 4.5 | 5 |
| ... | ... | ... | ... | ... | ... |
For 5 criteria (Quality, Price, Features, Customer Rating, Delivery Time):
"1,1,1,1,1" (equal weight)."+,+,-,+,-" (Quality +, Price +, Features -, Customer Rating +, Delivery Time -).Run:
topsis data.csv "1,1,1,1,1" "+,+,-,+,-" result.csv
Output CSV will have all input columns plus:
The result file contains:
Example message: Result file 'result.csv' created successfully.
assignment1_DS-main/
├── README.md
├── setup.py
├── data.csv # Sample input
├── 102303812-topsis/
│ ├── __init__.py
│ └── topsis.py # TOPSIS implementation
└── LICENSE
MIT License. See LICENSE for details.
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.0 | 3 Feb 2026 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 20 Oct, 15:10 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:73db1ee1aa0fc9d87dc63fb278236f59300f8cb50bbf069820381f36e4c2173c