A Python package for Topsis method implementation
Project description
TOPSIS-Tavish-102303246
This Python-based package provides an implementation of the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS). It is designed as a command-line application that evaluates multiple options against several criteria, incorporates user-defined weights and impacts, and produces a relative performance score along with a final ranking for each option.
Click Here for a live demo.
Installation
Install the package using pip as shown below:
pip install topsis-tavish-102303246
How to Use
The tool is operated from the terminal. To run it, you need an input dataset (CSV or Excel format), a list of criterion weights, a list of impacts, and an output filename where results will be stored.
Command Format
topsis <InputFile> <Weights> <Impacts> <OutputFile>
Parameter Details
-
InputFile
- Path to a
.csvor.xlsxfile. - The dataset must include at least three columns.
- The first column should contain identifiers for the alternatives (e.g., A1, A2, A3). This column is excluded from calculations but retained in the output.
- All remaining columns must contain numerical values representing evaluation criteria.
- Path to a
-
Weights
- A comma-separated list of numerical values representing the relative importance of each criterion
(example:
"2,1,3,1").
- A comma-separated list of numerical values representing the relative importance of each criterion
(example:
-
Impacts
- A comma-separated list using
+or-symbols to indicate whether higher or lower values are preferred.+→ Higher values are desirable-→ Lower values are desirable
- A comma-separated list using
-
OutputFile
- Name of the CSV file where the computed TOPSIS scores and rankings will be saved.
Demonstration Example
Assume we want to compare four laptop models using four evaluation parameters: Cost, Battery Life, Performance, and Weight.
1. Sample Input (laptops.csv)
| Laptop | Cost | Battery | Performance | Weight |
|---|---|---|---|---|
| L1 | 700 | 8 | 7 | 2.2 |
| L2 | 650 | 6 | 6 | 2.5 |
| L3 | 800 | 9 | 9 | 2.0 |
| L4 | 720 | 7 | 8 | 2.3 |
Decision Logic:
- Cost: Lower is preferable (
-) - Battery Life: Higher is preferable (
+) - Performance: Higher is preferable (
+) - Weight: Lower is preferable (
-)
2. Running the Tool
Execute the following command:
topsis laptops.csv "1,1,2,1" "-,+,+,-" output.csv
- Weights: Performance is given more importance than the other criteria.
- Impacts: Cost and Weight are treated as minimizing factors.
3. Generated Output (output.csv)
The resulting file includes the original dataset along with two additional fields: TOPSIS Score and Rank.
| Laptop | Cost | Battery | Performance | Weight | TOPSIS Score | Rank |
|---|---|---|---|---|---|---|
| L1 | 700 | 8 | 7 | 2.2 | 0.521 | 3 |
| L2 | 650 | 6 | 6 | 2.5 | 0.312 | 4 |
| L3 | 800 | 9 | 9 | 2.0 | 0.742 | 1 |
| L4 | 720 | 7 | 8 | 2.3 | 0.603 | 2 |
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_tavish_102303246-0.1.1.tar.gz.
File metadata
- Download URL: topsis_tavish_102303246-0.1.1.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
921e98427b208380957d24300b863ad5c03dbdacad7b218d5711a51cc5039e9b
|
|
| MD5 |
4ef1b9c9ab017987a69a033abafd3a1e
|
|
| BLAKE2b-256 |
4ca8c925381b7adef4c327f3e50b98873ef76ebc2cc6f2b11ef4ae273e31b32b
|
File details
Details for the file topsis_tavish_102303246-0.1.1-py3-none-any.whl.
File metadata
- Download URL: topsis_tavish_102303246-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a467a690f3b7bbce6d7e638a1b11136047fcdfa0b396385b2c5de98d71e550d7
|
|
| MD5 |
a616c82ec7b18397ae5427fde0036fe5
|
|
| BLAKE2b-256 |
ba1f4b2fdf94155688b831b7339c8366766c5d49963e254bcc4c00b752f9229c
|