Catalog PyPI
PACKAGE EXPLORERView in registry

102303812-topsis

PyPI

A Python package to implement TOPSIS

Versions collected1
Direct dependencies0From release 1.0.0
Last observed20 Oct, 15:10 UTC

README

Version 1.0.0 documentation

102303812-topsis

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

Author: Harsh Tanwar
Roll No: 102303812
Email: htanwar_be23@thapar.edu

Repository: Assignment1-Topsis


What is TOPSIS?

TOPSIS ranks alternatives by comparing each to an ideal positive and ideal negative solution. Alternatives closer to the ideal positive and farther from the ideal negative get higher scores and better ranks. The method uses vector normalization, weighted criteria, and Euclidean distances to compute a performance score for each alternative.


Requirements

  • Python 3.6+
  • pandas – data handling
  • numpy – numerical operations

Install dependencies:

pip install pandas numpy

Installation

From PyPI (if published)

pip install 102303812-topsis

From source (clone or download the repo)

git clone https://github.com/htan11/course-materials.git
cd course-materials/UCS654/Assignment1-Topsis
pip install .

Or, in the folder containing setup.py:

pip install .

Usage

Command line

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

Example (with 5 criteria):

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

As a Python module

(Because the package name contains a hyphen, use importlib to import.)

import importlib
topsis = getattr(importlib.import_module("102303812-topsis"), "topsis")

topsis("data.csv", "1,1,1,1,1", "+,+,-,+,-", "result.csv")

Parameters

ParameterDescription
InputDataFilePath to a CSV file: first column = alternative names, remaining columns = numeric criterion values. Must have a header row.
WeightsComma-separated weights for each criterion (e.g. "1,1,1,2,1"). Number of values must match number of criteria.
ImpactsComma-separated impacts: + for beneficial (higher is better), - for non-beneficial (lower is better). Same count as criteria.
OutputResultFileNamePath for the output CSV. Contains original columns plus Topsis Score and Rank.
  • Beneficial (+): e.g. Quality, Customer Rating — higher value is better.
  • Non-beneficial (-): e.g. Price, Delivery Time — lower value is better.

Input file format

CSV with a header; first column = alternative names, rest = numeric only.

Example (data.csv):

ProductQualityPriceFeaturesCustomer RatingDelivery Time
A18.54507.24.33
A27.83808.14.55
..................
  • Column 1: labels (not used in math).
  • Columns 2–6: criteria. Weights and impacts must be given for each of these in order.

Example with this dataset

For 5 criteria (Quality, Price, Features, Customer Rating, Delivery Time):

  • Weights: "1,1,1,1,1" (equal weight).
  • Impacts: "+,+,-,+,-" (Quality +, Price +, Features -, Customer Rating +, Delivery Time -).

Run:

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

Output CSV will have all input columns plus:

  • Topsis Score – higher is better.
  • Rank – 1 = best alternative.

Output

The result file contains:

  • All original columns.
  • Topsis Score – performance score in [0, 1].
  • Rank – integer rank (1 = best).

Example message: Result file 'result.csv' created successfully.


Project structure

assignment1_DS-main/
├── README.md
├── setup.py
├── data.csv              # Sample input
├── 102303812-topsis/
│   ├── __init__.py
│   └── topsis.py         # TOPSIS implementation
└── LICENSE

License

MIT License. See LICENSE for details.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
1.0.03 Feb 20260

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
htan11/course-materials

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 15:10 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:73db1ee1aa0fc9d87dc63fb278236f59300f8cb50bbf069820381f36e4c2173c