Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsis_yashika_102303439-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topsis_yashika_102303439-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file topsis_yashika_102303439-1.0.0.tar.gz.

File metadata

File hashes

Hashes for topsis_yashika_102303439-1.0.0.tar.gz
Algorithm Hash digest
SHA256 687bd0b2a4de86bbf7ada08668edd7042218f9637702930670d954f73c6ae9ae
MD5 0739d3a68e4754daf872c8b653bd7dd9
BLAKE2b-256 389c4f9c12aec7be32ede7b3140a1c0fd080cb3e8a0545b6565d729f00ad163a

See more details on using hashes here.

File details

Details for the file topsis_yashika_102303439-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_yashika_102303439-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c12c96900619ccfadf3288daec3ca581feeaf866a0d68f0f3b34fa5319900e9
MD5 6b28c435d9d467c5bda4c22ad11329b3
BLAKE2b-256 2a4fab1e6ef4931d6ca39d8e3029e8ab03e1503f4cfa48052005b8961bdebb0e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page