Skip to main content

A Python package for Topsis method implementation

Project description

TOPSIS-Himanshu-102303244

A Python package to implement the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS). This command-line tool takes a dataset of alternatives and criteria, applies weights and impacts, and calculates a ranking score for each alternative.

Installation

You can install this package via pip:

pip install topsis-himanshu-102303244

Usage

The package can be used through the command line. It requires an input CSV or Excel file containing your data, a string of weights, a string of impacts, and the name of the output file.

Command Syntax

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

Arguments

  1. InputDataFile: Path to the .csv or .xlsx file.
  • The file must contain 3 or more columns.
  • First column: Object/Model Name (e.g., M1, M2, M3). This column is not used in calculations but is preserved in the output.
  • Remaining columns: Numeric values representing the criteria for each object.
  1. Weights: Comma-separated numbers indicating the importance of each criterion (e.g., "1,1,1,1").
  2. Impacts: Comma-separated signs (+ or -) indicating the desired direction of the criterion.
  • +: Higher value is better (Profit).
  • -: Lower value is better (Cost).
  1. ResultFileName: Name of the output CSV file where results will be saved.

Example

Let's assume we want to rank 5 different mobile phone models based on 4 criteria: Price, Storage, Camera, and Looks.

1. Input Data (data.csv)

Model Price Storage Camera Looks
M1 250 16 12 5
M2 200 16 8 3
M3 300 32 16 4
M4 275 32 8 4
M5 225 16 16 2
  • Criteria Analysis:
  • Price: Lower is better (- impact).
  • Storage: Higher is better (+ impact).
  • Camera: Higher is better (+ impact).
  • Looks: Higher is better (+ impact).

2. Execution

Run the following command in your terminal:

topsis data.csv "1,1,1,1" "-,+,+,+" result.csv
  • Weights: 1,1,1,1 (All criteria are equally important).
  • Impacts: -,+,+,+ (Price is negative impact, others are positive).

3. Output Data (result.csv)

The tool generates a new file result.csv containing the original data with two additional columns: Topsis Score and Rank.

Model Price Storage Camera Looks Topsis Score Rank
M1 250 16 12 5 0.534277 3
M2 200 16 8 3 0.308368 5
M3 300 32 16 4 0.691632 1
M4 275 32 8 4 0.534737 2
M5 225 16 16 2 0.492650 4

License

This project is licensed under the 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_himanshu_102303244-0.1.1.tar.gz (2.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_himanshu_102303244-0.1.1-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file topsis_himanshu_102303244-0.1.1.tar.gz.

File metadata

File hashes

Hashes for topsis_himanshu_102303244-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6b6f5360f56fc9a5cda96e6c5c99866fb9703f0221f97e9889cf47498b1c5327
MD5 f17515625092d51d39a58f94989e5f39
BLAKE2b-256 277f9abcce628ac94aec9d14b691c4757ef42b4be0064149c61eecb9d364fb31

See more details on using hashes here.

File details

Details for the file topsis_himanshu_102303244-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_himanshu_102303244-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c592a5fcf90e44a189ec4e886fe24a76512fd1e1cb1b84757262d66a7faa5c8e
MD5 fe8423d569bd5ffa0380f0c8c6bf31cb
BLAKE2b-256 994e7f9f605ad5bc50f0453ee6b28f0ca29bb53d30bc79bd7f3f1fe6df56b5ed

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