Skip to main content

A Python package for implementing the TOPSIS method.

Project description

TOPSIS Implementation in Python

Overview This Python script implements TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution), a multi-criteria decision-making method to rank alternatives based on criteria weights and impacts.

Requirements

  • Python 3.x
  • Libraries: Install via
    pip install pandas numpy

Files

  1. 102217055.py: Main Python script.
  2. Input File: CSV containing alternatives and criteria.
  3. Output File: CSV with calculated scores and ranks.

Input Format

  • First Column: Alternative names (e.g., A, B, C).
  • Other Columns: Numerical criteria values.

Example (data.csv): Alternatives,Criterion1,Criterion2,Criterion3 A,20,300,50 B,25,250,60 C,30,200,70

Usage Run the script with: python 102217055.py

Arguments:

  1. : Path to input CSV.
  2. : Comma-separated weights (e.g., 1,1,1).
  3. : Comma-separated impacts (+ for beneficial, - for non-beneficial).
  4. : Path to save output CSV.

Example: python 102217055.py data.csv "1,1,1" "+,+,-" result.csv

Output Format The output CSV includes the input data with:

  • Topsis Score: Calculated score for each alternative.
  • Rank: Based on TOPSIS score.

Example (result.csv): Alternatives,Criterion1,Criterion2,Criterion3,Topsis Score,Rank A,20,300,50,0.78,2 B,25,250,60,0.85,1 C,30,200,70,0.63,3

Error Handling

  1. File Errors: Ensure the input file exists and is correctly formatted.
  2. Mismatch in Weights/Impacts: Ensure their count matches the criteria columns.
  3. Invalid Impacts: Use only + or -.

Method Overview

  1. Normalize: Scale values for comparability.
  2. Weighting: Apply weights to normalized values.
  3. Ideal Values: Determine best and worst values for criteria.
  4. Distance Calculation: Measure distances from ideal best/worst.
  5. Score & Rank: Compute scores and rank alternatives.

This script simplifies multi-criteria decision-making. Reach out for support if needed!

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_angad_singh_marwaha_102217055-0.1.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file topsis_angad_singh_marwaha_102217055-0.1.0.tar.gz.

File metadata

File hashes

Hashes for topsis_angad_singh_marwaha_102217055-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5cd99a516eae9b6416775ae579f0dfb4a25f859e6642f1930f64091e240d4e3
MD5 3ff0ea8b358b5072951dea9f4f0f7b70
BLAKE2b-256 4705aa201060eba422d45651931ddbb70686b5eac1b8f62c8174d9f7afddb57c

See more details on using hashes here.

File details

Details for the file Topsis_Angad_Singh_Marwaha_102217055-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for Topsis_Angad_Singh_Marwaha_102217055-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1756b30b0025cc6cdd42879b9ac0aa8a477ae88eb525d7b336d62ad5c645cd95
MD5 92d8997bff5494b453ea27329d84056c
BLAKE2b-256 088cb5d43b296786feb3065b90beb694146a97963b5ada0b2253a2384cb1aba3

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