Skip to main content

Calculate TOPSIS score and rank alternatives.

Project description

TOPSIS

This script calculates the TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) score and ranks alternatives based on the provided decision matrix, weights, and impacts. It uses the weights and impacts to determine the ideal best and worst values, then calculates the distance of each alternative from these values to derive the final score and ranking.

Installation

There are no external dependencies, but you need to have Python and pandas installed to run the script.

pip install 102203836_topsis

How to use it?

Step 1: Prepare the Data

The input data should be a CSV file containing the following columns:

The first column should contain the fund names. The remaining columns should contain the criteria values for each alternative (row). Example CSV format:

Fund Name,P1,P2,P3,P4,P5 M1,0.67,0.45,6.3,38.2,11.41 M2,0.81,0.66,6,42.4,12.47 M3,0.68,0.46,3,60.2,16.09

Step 2: Run the Script

To run the script, use the following command in the terminal:

python .py Example: python topsis.py data.csv "1,1,1,2,1" "+,+,-,+,-" results.csv Where: .py is the name of the script file (e.g., topsis.py). is your input CSV file (e.g., data.csv). is a comma-separated string of weights for each criterion (e.g., "1,1,1,2,1"). is a comma-separated string of impacts for each criterion (e.g., "+,+,-,+,-"). is the file where the results will be saved (e.g., results.csv).

Step 3: Output

The output will be a CSV file with the calculated TOPSIS scores and ranks for each alternative. ...

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_paras_102203836-1.0.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

Topsis_Paras_102203836-1.0.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: topsis_paras_102203836-1.0.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.4

File hashes

Hashes for topsis_paras_102203836-1.0.0.tar.gz
Algorithm Hash digest
SHA256 50d537ed5b098636747ecd58bd15724c1dc9f3a8f48f7f04b60ad9403e3a2437
MD5 7c4c1353d5740133ad6df8d0d54d155f
BLAKE2b-256 a7e8a865b48a49358f15103ea1444692762bb6f349f53fe733edbe5522349f91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Topsis_Paras_102203836-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 36305a8c1586a62dc9a1f673d0687ae2e32932ef0c88fec4cc4c864c56ad81a8
MD5 3ae3718ac1818602830b5c2460124ebc
BLAKE2b-256 3aab971151aec30cfa08f2012313bd7acbfce547ade58926f58bfc40d717c50d

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