Skip to main content

Project Description

  • for: Assignment-1(UCS654)
  • Submitted by: Himanshu Bansal
  • Roll no: 102103568
  • Group: 3COE20

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

This Python script implements the TOPSIS method for multi-criteria decision-making. It takes a CSV file containing a decision matrix, weights, and impacts as input, and produces a ranked result based on the TOPSIS score.

Installation

pip install Topsis-Himanshu-102103568

Usage

from Topsis_Himanshu_102103568.topsis import topsis 
inputFile="sample.csv"
weights="1,1,1,1"
impacts="-,+,+,+"
resultFile="result.csv" 
topsis(inputFile, weights, impacts, resultFile)

OR

You can use this package via command line as:

python -m Topsis_Himanshu_102103568.topsis [InputDataFile as .csv] [Weights as a string] [Impacts as a string] [ResultFileName as .csv]
  • InputDataFile: Path to the CSV file containing the input data.
  • Weights: Comma-separated weights for each criterion.
  • Impacts: Comma-separated impact direction for each criterion (+ for maximization, - for minimization).
  • ResultFileName: Name of the file to save the TOPSIS results.

Requirements

  • Python 3
  • pandas
  • numpy

Input File Format

The input data should be in a CSV format with the following structure:

Fund Name P1 P2 P3 P4 P5
M1 0.84 0.71 6.7 42.1 12.59
M2 0.91 0.83 7 31.7 10.11
M3 0.79 0.62 4.8 46.7 13.23
M4 0.78 0.61 6.4 42.4 12.55
M5 0.94 0.88 3.6 62.2 16.91
M6 0.88 0.77 6.5 51.5 14.91
M7 0.66 0.44 5.3 48.9 13.83
M8 0.93 0.86 3.4 37 10.55

Output

The script generates a CSV file containing the TOPSIS score and rank for each object:

Fund Name P1 P2 P3 P4 P5 Topsis Score Rank
M1 0.84 0.71 6.7 42.1 12.59 0.41855328299643013 7.0
M2 0.91 0.83 7.0 31.7 10.11 0.4663977143091959 5.0
M3 0.79 0.62 4.8 46.7 13.23 0.5374784843237046 3.0
M4 0.78 0.61 6.4 42.4 12.55 0.4295182212044884 6.0
M5 0.94 0.88 3.6 62.2 16.91 0.5453066145383307 2.0
M6 0.88 0.77 6.5 51.5 14.91 0.39814192807166954 8.0
M7 0.66 0.44 5.3 48.9 13.83 0.4743648907682155 4.0
M8 0.93 0.86 3.4 37.0 10.55 0.6392872727749049 1.0

Error Handling

  • If the input file is not found, an error message will be displayed.
  • If the number of weights, impacts, or columns in the decision matrix is incorrect, a ValueError will be raised.
  • If the columns from the 2nd to the last do not contain numeric values, a ValueError will be raised.
  • Any unexpected errors during the execution will be displayed.

LICENSE

(c) 2024 Himanshu Bansal

This project is licensed under the MIT License.

Metadata

Release files for Topsis-Himanshu-102103568 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Topsis-Himanshu-102103568 1.0.3
File Size Uploaded
Topsis-Himanshu-102103568-1.0.3.tar.gz 4.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Topsis-Himanshu-102103568 1.0.3
File Interpreter ABI Platform
Topsis_Himanshu_102103568-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.8 kB

Release files / Topsis-Himanshu-102103568-1.0.3.tar.gz

Download URL Topsis-Himanshu-102103568-1.0.3.tar.gz
Size 4.7 kB
Tags Source
SHA-256 checksum
How to use checksums
545422ada9f437fca07116ca28245b51fb00922d88f8d498e39d652ae728e498
BLAKE2b-256 checksum
How to use checksums
5ee5f92df4ff49b0f6b34d5ed4c4118b66952d37fc920d479a5a809928f1a5b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / Topsis_Himanshu_102103568-1.0.3-py3-none-any.whl

Download URL Topsis_Himanshu_102103568-1.0.3-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7e473daa88ec2da2caae77f7092d369f42b1184133177d9c8da4e16e66e85652
BLAKE2b-256 checksum
How to use checksums
ea7b947c8f9e74d61f55fc95fd80a306f47dd76ff98a70373c38f41be5142c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page