Skip to main content

A command-line Python package to implement the TOPSIS method.

Project description

Topsis-Hitesh-102317248

A Python package implementing the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS) for Multi-Criteria Decision Making (MCDM). This package works as a Command Line Tool and generates an output CSV file containing the TOPSIS Score and Rank.

Installation

Install the package from PyPI using:

pip install Topsis-Hitesh-102317248

Quick Start

Command Syntax

Once installed, you can use the topsis command directly from your terminal, following the syntax given below.

topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>

Parameters

The command accepts exactly 4 parameters:

Parameter Format Example Description
Input file Path string "data.csv" Path to your CSV file
Weights Comma-separated string "1,1,1,1,2" Weight for each criterion
Impacts Comma-separated string "+,+,+,-,+" + for benefit, - for cost
Output file Path string "result.csv" Where to save results

Example Execution

Grab an input csv or excel file strictly adheres to the following structure:

  1. The file must have at least 3 columns- Candidate Identifier column followed by min. 2 criteria.
  2. The first column must contain the names/IDs of the alternatives.
  3. Criteria columns must contain only numeric values.

A sample dataset file (data.csv) is shown below:

Fund Name P1 P2 P3 P4 P5
M1 0.94 0.88 6.5 38.8 11.78
M2 0.69 0.48 4.4 59.8 16.34
M3 0.62 0.38 3.8 41.3 11.53
M4 0.63 0.40 6.1 50.5 14.41
M5 0.78 0.61 5.2 67.8 18.60
M6 0.61 0.37 5.6 34.6 10.30
M7 0.69 0.48 4.8 57.8 15.94
M8 0.75 0.56 6.1 62.4 17.45

Run the following command through the terminal.

topsis data.csv "1,1,1,1,2" "+,+,+,-,+" result.csv

The output file (result.csv) generated will look like this:

Fund Name P1 P2 P3 P4 P5 Topsis Score Rank
M1 0.94 0.88 6.5 38.8 11.78 0.5840384375 2
M2 0.69 0.48 4.4 59.8 16.34 0.4489649725 4
M3 0.62 0.38 3.8 41.3 11.53 0.2617528226 8
M4 0.63 0.40 6.1 50.5 14.41 0.3974983163 6
M5 0.78 0.61 5.2 67.8 18.60 0.5917499869 1
M6 0.61 0.37 5.6 34.6 10.30 0.3159064238 7
M7 0.69 0.48 4.8 57.8 15.94 0.4461587287 5
M8 0.75 0.56 6.1 62.4 17.45 0.5714234615 3

Sample input file is available in the sample_data/ folder. Sample output file is available in the results/ folder.

Important Notes

  • The command accepts exactly four parameters.
  • Number of weights and impacts must match number of criteria columns.
  • Impacts must be only + or -.
  • Make sure the criteria columns must be numeric as mentioned earlier.
  • No cell should be empty.

License

This project is licensed under the MIT License. See LICENSE for more information.

Author

Hitesh Yadav
Penultimate-Year Student, BE-CSE
Thapar Institute of Engineering and Technology, Patiala

Let's Connect: GitHub | LinkedIn | Email


If you find this package useful, please ⭐ star it on GitHub!

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_hitesh_102317248-1.0.1.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

topsis_hitesh_102317248-1.0.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file topsis_hitesh_102317248-1.0.1.tar.gz.

File metadata

  • Download URL: topsis_hitesh_102317248-1.0.1.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.10

File hashes

Hashes for topsis_hitesh_102317248-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6d37b1511a9877f741f1097138e94b0f363256ae3f692589a8259cd35dcd814a
MD5 178a169acadf5344c19671314d85b6a9
BLAKE2b-256 d79d60f378c5c26b9e5bd5c2e99d3d7455c99476288bee103154df8bc6db4efb

See more details on using hashes here.

File details

Details for the file topsis_hitesh_102317248-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_hitesh_102317248-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6463fe89931c41006eb9a4678d6abfdef36a1df2b1861b9d51e28ae9f710b76c
MD5 1c0987a6165d8ffcc4618d2e830b4cfc
BLAKE2b-256 a70d141009ff82a7c60f630d10aa20e01a2b5db22c3c1a6daf9d73c660664654

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