A Python package for TOPSIS method
Project description
TOPSIS Python Package
This Python package implements the TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) method, which is a popular multi-criteria decision-making (MCDM) technique used to rank alternatives based on their distance from an ideal solution.
The package is designed as a command-line tool and validates all inputs as per the problem requirements.
Features
- Command-line execution
- CSV file input
- Supports multiple criteria
- Handles weights and impacts
- Proper input validation and error handling
- Outputs TOPSIS score and rank
- Can be installed using
pip
Installation
After uploading the package to PyPI, install it using:
pip install Topsis-Yashika-102303439
Usage
- The program must be executed from the command line
Syntax
- python topsis.py <InputDataFile> <Weights> <Impact> <OutputResultFileName>
Example
- python topsis.py data.csv "1,1,1,1,1" "+,+,-,+,+" output-result.csv
Input File Format
- The input file must be in CSV format
- The file must contain three or more columns
- The first column should contain names/identifiers of alternatives
- From the second column onward, all values must be numeric
Sample Input
Fund Name,P1,P2,P3,P4,P5
M1,0.82,0.67,7,48.1,14.15
M2,0.83,0.69,3.3,50.7,13.88
Weights and Impacts
- Weights must be numeric
- Impacts must be either:
- + for benefit criteria
- - for cost criteria
- Weights and impacts must be comma-separated
- Number of weights = number of impacts = number of criteria
Output File
- Output is generated in CSV format
- Two new columns are added:
- Topsis Score
- Rank
- Higher TOPSIS score indicates a better alternative
Error Handling
- The program checks and handles the following errors:
- Incorrect number of command-line arguments
- Input file not found
- Less than three columns in input file
- Non-numeric values in criteria columns
- Mismatch between number of criteria, weights, and impacts
- Invalid impact symbols
Author
- Yashika
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_yashika_102303439-1.0.0.tar.gz.
File metadata
- Download URL: topsis_yashika_102303439-1.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
687bd0b2a4de86bbf7ada08668edd7042218f9637702930670d954f73c6ae9ae
|
|
| MD5 |
0739d3a68e4754daf872c8b653bd7dd9
|
|
| BLAKE2b-256 |
389c4f9c12aec7be32ede7b3140a1c0fd080cb3e8a0545b6565d729f00ad163a
|
File details
Details for the file topsis_yashika_102303439-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_yashika_102303439-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c12c96900619ccfadf3288daec3ca581feeaf866a0d68f0f3b34fa5319900e9
|
|
| MD5 |
6b28c435d9d467c5bda4c22ad11329b3
|
|
| BLAKE2b-256 |
2a4fab1e6ef4931d6ca39d8e3029e8ab03e1503f4cfa48052005b8961bdebb0e
|