Skip to main content

A Python package for TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)

Project description

Topsis-Kavish-102317012

A Python package for implementing TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) for multi-criteria decision analysis.

What is TOPSIS?

TOPSIS is a multi-criteria decision analysis method that helps in ranking alternatives based on their closeness to the ideal solution. It is widely used in decision-making scenarios where multiple conflicting criteria need to be considered.

Installation

You can install the package using pip:

pip install Topsis-Kavish-102317012

Usage

Command Line

After installation, you can use the topsis command directly from the terminal:

topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>

Example:

topsis data.csv "1,1,1,1" "+,+,-,+" output.csv

Python Script

You can also use it in your Python code:

from topsis_kavish_102317012 import topsis

topsis('data.csv', '1,1,1,1', '+,+,-,+', 'output.csv')

Input File Format

The input CSV file should have the following structure:

  • First column: Names of alternatives (e.g., Fund Name, Model Name)
  • Remaining columns: Numeric criteria values

Example (data.csv):

Fund Name,P1,P2,P3,P4
M1,0.87,0.40,6.7,47.9
M2,0.66,0.45,6.9,48.5
M3,0.66,0.42,5.4,49.7

Parameters

  • InputDataFile: Path to the input CSV file
  • Weights: Comma-separated weights for each criterion (e.g., "1,1,1,1")
  • Impacts: Comma-separated impacts for each criterion, either '+' (beneficial) or '-' (non-beneficial)
  • OutputResultFileName: Path for the output CSV file

Output

The output CSV file will contain:

  • All original columns
  • Topsis Score: Calculated TOPSIS score for each alternative
  • Rank: Ranking based on TOPSIS score (1 is best)

Requirements

  • Python >= 3.6
  • pandas >= 1.0.0
  • numpy >= 1.18.0

Validations

The package performs the following validations:

  • Input file must have at least 3 columns
  • Columns from 2nd to last must contain only numeric values
  • Number of weights must equal number of criteria
  • Number of impacts must equal number of criteria
  • Impacts must be either '+' or '-'

Author

Kavish
Roll Number: 102317012

License

MIT License

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

Uploaded Source

Built Distribution

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

topsis_kavish_102317012-1.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: topsis_kavish_102317012-1.0.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for topsis_kavish_102317012-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e2f35970d43bd728bd76480f57ded19ea42a83fed5f19cd5e4ae7103521de4ce
MD5 78e28f9c486864d5f754485e1da89fb7
BLAKE2b-256 aecf0702325b56d77c061175497142a15cdbd854f41bcaa16209021327367daf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_kavish_102317012-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5aa11506f038fc1f4c63c254075fba53f57bcae214aeb4120d2a4f77b47b403e
MD5 6f43211b937b891d0a03451dc6fa68e7
BLAKE2b-256 44749427bfc78577c3270e4edbab8e8eb529452c5a36174545255fe0987e6475

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