topsis-abhayjeet 1.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: topsis-abhayjeet
3
+ Version: 1.1.2
4
+ Summary: Implementation of TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)
5
+ Home-page: https://pypi.org/project/topsis-abhayjeet/
6
+ Author: Abhayjeet
7
+ Author-email: abhayjeet5465@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: pandas
14
+ Requires-Dist: numpy
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # TOPSIS Python Package
26
+
27
+ This package provides an implementation of the TOPSIS
28
+ (Technique for Order Preference by Similarity to Ideal Solution)
29
+ method for multi-criteria decision making.
30
+
31
+ ## Installation
32
+ ```bash
33
+ pip install topsis-abhayjeet
34
+
35
+ Usage
36
+
37
+ topsis input.csv "1,1,1,2" "+,+,-,+" output.csv
38
+ Input Format
39
+ First column: Object/Alternative names
40
+
41
+ Remaining columns: Numeric criteria values
42
+
43
+ Output
44
+ TOPSIS Score
45
+ Rank
46
+
47
+ Author
48
+ Abhayjeet
49
+
50
+
51
+ ---
52
+ `LICENSE`
53
+
54
+ ```text
55
+ MIT License
56
+
57
+ Copyright (c) 2026 Abhayjeet
58
+
59
+ Permission is hereby granted, free of charge, to any person obtaining a copy
60
+ of this software and associated documentation files (the "Software"), to deal
61
+ in the Software without restriction, including without limitation the rights
62
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63
+ copies of the Software, subject to the following conditions:
64
+
65
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
66
+
67
+
@@ -0,0 +1,43 @@
1
+ # TOPSIS Python Package
2
+
3
+ This package provides an implementation of the TOPSIS
4
+ (Technique for Order Preference by Similarity to Ideal Solution)
5
+ method for multi-criteria decision making.
6
+
7
+ ## Installation
8
+ ```bash
9
+ pip install topsis-abhayjeet
10
+
11
+ Usage
12
+
13
+ topsis input.csv "1,1,1,2" "+,+,-,+" output.csv
14
+ Input Format
15
+ First column: Object/Alternative names
16
+
17
+ Remaining columns: Numeric criteria values
18
+
19
+ Output
20
+ TOPSIS Score
21
+ Rank
22
+
23
+ Author
24
+ Abhayjeet
25
+
26
+
27
+ ---
28
+ `LICENSE`
29
+
30
+ ```text
31
+ MIT License
32
+
33
+ Copyright (c) 2026 Abhayjeet
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining a copy
36
+ of this software and associated documentation files (the "Software"), to deal
37
+ in the Software without restriction, including without limitation the rights
38
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39
+ copies of the Software, subject to the following conditions:
40
+
41
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
42
+
43
+
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=42", "wheel"]
3
+ build-backend = "setuptools.build_meta"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,29 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="topsis-abhayjeet",
5
+ version="1.1.2",
6
+ author="Abhayjeet",
7
+ url="https://pypi.org/project/topsis-abhayjeet/",
8
+ author_email="abhayjeet5465@gmail.com",
9
+ description="Implementation of TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)",
10
+ long_description=open("README.md", encoding="utf-8").read(),
11
+ long_description_content_type="text/markdown",
12
+
13
+ packages=find_packages(),
14
+ install_requires=[
15
+ "pandas",
16
+ "numpy"
17
+ ],
18
+ entry_points={
19
+ "console_scripts": [
20
+ "topsis=topsis_abhayjeet.topsis:main"
21
+ ]
22
+ },
23
+ python_requires=">=3.7",
24
+ classifiers=[
25
+ "Programming Language :: Python :: 3",
26
+ "License :: OSI Approved :: MIT License",
27
+ "Operating System :: OS Independent",
28
+ ],
29
+ )
@@ -0,0 +1 @@
1
+ __version__ = "1.0.0"
@@ -0,0 +1,89 @@
1
+ import sys
2
+ import pandas as pd
3
+ import numpy as np
4
+ import os
5
+
6
+ def error(msg):
7
+ print("Error:", msg)
8
+ sys.exit(1)
9
+
10
+ def main():
11
+ # ---- Argument check ----
12
+ if len(sys.argv) != 5:
13
+ error("Usage: python topsis.py <InputFile> <Weights> <Impacts> <OutputFile>")
14
+
15
+ input_file = sys.argv[1]
16
+ weights = sys.argv[2]
17
+ impacts = sys.argv[3]
18
+ output_file = sys.argv[4]
19
+
20
+ # ---- File check ----
21
+ if not os.path.isfile(input_file):
22
+ error("Input file not found")
23
+
24
+ # ---- Read file ----
25
+ if input_file.endswith(".csv"):
26
+ data = pd.read_csv(input_file)
27
+ elif input_file.endswith(".xlsx"):
28
+ data = pd.read_excel(input_file)
29
+ else:
30
+ error("Input file must be .csv or .xlsx")
31
+
32
+ # ---- Column count ----
33
+ if data.shape[1] < 3:
34
+ error("Input file must contain at least 3 columns")
35
+
36
+ # ---- Extract criteria ----
37
+ criteria = data.iloc[:, 1:]
38
+
39
+ # ---- Numeric check (FIXED) ----
40
+ if not criteria.apply(lambda col: pd.api.types.is_numeric_dtype(col)).all():
41
+ error("Criteria columns must be numeric")
42
+
43
+ # ---- Weights & impacts ----
44
+ weights = list(map(float, weights.split(",")))
45
+ impacts = impacts.split(",")
46
+
47
+ if len(weights) != criteria.shape[1]:
48
+ error("Number of weights must equal number of criteria")
49
+
50
+ if len(impacts) != criteria.shape[1]:
51
+ error("Number of impacts must equal number of criteria")
52
+
53
+ for i in impacts:
54
+ if i not in ['+', '-']:
55
+ error("Impacts must be '+' or '-' only")
56
+
57
+ weights = np.array(weights)
58
+
59
+ # ---- TOPSIS ----
60
+ norm = criteria / np.sqrt((criteria ** 2).sum())
61
+ weighted = norm * weights
62
+
63
+ ideal_best, ideal_worst = [], []
64
+
65
+ for i in range(len(impacts)):
66
+ if impacts[i] == '+':
67
+ ideal_best.append(weighted.iloc[:, i].max())
68
+ ideal_worst.append(weighted.iloc[:, i].min())
69
+ else:
70
+ ideal_best.append(weighted.iloc[:, i].min())
71
+ ideal_worst.append(weighted.iloc[:, i].max())
72
+
73
+ ideal_best = np.array(ideal_best)
74
+ ideal_worst = np.array(ideal_worst)
75
+
76
+ d_pos = np.sqrt(((weighted - ideal_best) ** 2).sum(axis=1))
77
+ d_neg = np.sqrt(((weighted - ideal_worst) ** 2).sum(axis=1))
78
+
79
+ score = d_neg / (d_pos + d_neg)
80
+
81
+ data["Topsis Score"] = score
82
+ data["Rank"] = score.rank(ascending=False, method="dense").astype(int)
83
+
84
+ # ---- Save output ----
85
+ data.to_csv(output_file, index=False)
86
+ print("TOPSIS completed successfully")
87
+
88
+ if __name__ == "__main__":
89
+ main()
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: topsis-abhayjeet
3
+ Version: 1.1.2
4
+ Summary: Implementation of TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)
5
+ Home-page: https://pypi.org/project/topsis-abhayjeet/
6
+ Author: Abhayjeet
7
+ Author-email: abhayjeet5465@gmail.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.7
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: pandas
14
+ Requires-Dist: numpy
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # TOPSIS Python Package
26
+
27
+ This package provides an implementation of the TOPSIS
28
+ (Technique for Order Preference by Similarity to Ideal Solution)
29
+ method for multi-criteria decision making.
30
+
31
+ ## Installation
32
+ ```bash
33
+ pip install topsis-abhayjeet
34
+
35
+ Usage
36
+
37
+ topsis input.csv "1,1,1,2" "+,+,-,+" output.csv
38
+ Input Format
39
+ First column: Object/Alternative names
40
+
41
+ Remaining columns: Numeric criteria values
42
+
43
+ Output
44
+ TOPSIS Score
45
+ Rank
46
+
47
+ Author
48
+ Abhayjeet
49
+
50
+
51
+ ---
52
+ `LICENSE`
53
+
54
+ ```text
55
+ MIT License
56
+
57
+ Copyright (c) 2026 Abhayjeet
58
+
59
+ Permission is hereby granted, free of charge, to any person obtaining a copy
60
+ of this software and associated documentation files (the "Software"), to deal
61
+ in the Software without restriction, including without limitation the rights
62
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63
+ copies of the Software, subject to the following conditions:
64
+
65
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
66
+
67
+
@@ -0,0 +1,11 @@
1
+ README.md
2
+ pyproject.toml
3
+ setup.py
4
+ topsis_abhayjeet/__init__.py
5
+ topsis_abhayjeet/topsis.py
6
+ topsis_abhayjeet.egg-info/PKG-INFO
7
+ topsis_abhayjeet.egg-info/SOURCES.txt
8
+ topsis_abhayjeet.egg-info/dependency_links.txt
9
+ topsis_abhayjeet.egg-info/entry_points.txt
10
+ topsis_abhayjeet.egg-info/requires.txt
11
+ topsis_abhayjeet.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ topsis = topsis_abhayjeet.topsis:main
@@ -0,0 +1,2 @@
1
+ pandas
2
+ numpy
@@ -0,0 +1 @@
1
+ topsis_abhayjeet