Topsis-Sommit-102303184 0.0.2__tar.gz → 0.0.3__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.
- {topsis_sommit_102303184-0.0.2/Topsis_Sommit_102303184.egg-info → topsis_sommit_102303184-0.0.3}/PKG-INFO +5 -3
- topsis_sommit_102303184-0.0.3/Topsis_Assignment/topsis.py +71 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3/Topsis_Sommit_102303184.egg-info}/PKG-INFO +5 -3
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/setup.py +11 -10
- topsis_sommit_102303184-0.0.2/Topsis_Assignment/topsis.py +0 -69
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/LICENSE +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/README.md +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Assignment/__init__.py +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Sommit_102303184.egg-info/SOURCES.txt +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Sommit_102303184.egg-info/dependency_links.txt +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Sommit_102303184.egg-info/entry_points.txt +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Sommit_102303184.egg-info/requires.txt +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Sommit_102303184.egg-info/top_level.txt +0 -0
- {topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/setup.cfg +0 -0
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Topsis-Sommit-102303184
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: TOPSIS implementation using Python
|
|
5
5
|
Author: Sommit
|
|
6
6
|
Author-email: sommit312@gmail.com
|
|
7
|
-
Keywords:
|
|
7
|
+
Keywords: topsis,mcdm,decision making,ranking
|
|
8
8
|
Classifier: Development Status :: 3 - Alpha
|
|
9
9
|
Classifier: Intended Audience :: Education
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
|
13
12
|
Classifier: Operating System :: Unix
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Requires-Python: >=3.7
|
|
14
15
|
Description-Content-Type: text/markdown
|
|
15
16
|
License-File: LICENSE
|
|
16
17
|
Requires-Dist: pandas
|
|
@@ -23,6 +24,7 @@ Dynamic: description-content-type
|
|
|
23
24
|
Dynamic: keywords
|
|
24
25
|
Dynamic: license-file
|
|
25
26
|
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
26
28
|
Dynamic: summary
|
|
27
29
|
|
|
28
30
|
# Topsis-Sommit-102303184
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import pandas as pd
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
def main():
|
|
6
|
+
if len(sys.argv) != 5:
|
|
7
|
+
print("Error: Incorrect number of parameters")
|
|
8
|
+
sys.exit(1)
|
|
9
|
+
|
|
10
|
+
input_file = sys.argv[1]
|
|
11
|
+
weights = sys.argv[2].split(',')
|
|
12
|
+
impacts = sys.argv[3].split(',')
|
|
13
|
+
output_file = sys.argv[4]
|
|
14
|
+
|
|
15
|
+
try:
|
|
16
|
+
df = pd.read_csv(input_file)
|
|
17
|
+
except:
|
|
18
|
+
print("Error: File not found")
|
|
19
|
+
sys.exit(1)
|
|
20
|
+
|
|
21
|
+
if df.shape[1] < 3:
|
|
22
|
+
print("Error: Input file must contain three or more columns")
|
|
23
|
+
sys.exit(1)
|
|
24
|
+
|
|
25
|
+
data = df.iloc[:, 1:]
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
data = data.astype(float)
|
|
29
|
+
except:
|
|
30
|
+
print("Error: From 2nd to last columns must contain numeric values only")
|
|
31
|
+
sys.exit(1)
|
|
32
|
+
|
|
33
|
+
if len(weights) != data.shape[1] or len(impacts) != data.shape[1]:
|
|
34
|
+
print("Error: Number of weights, impacts and columns must be same")
|
|
35
|
+
sys.exit(1)
|
|
36
|
+
|
|
37
|
+
for i in impacts:
|
|
38
|
+
if i not in ['+', '-']:
|
|
39
|
+
print("Error: Impacts must be either + or -")
|
|
40
|
+
sys.exit(1)
|
|
41
|
+
|
|
42
|
+
weights = np.array(weights, dtype=float)
|
|
43
|
+
|
|
44
|
+
norm = np.sqrt((data ** 2).sum())
|
|
45
|
+
normalized_data = data / norm
|
|
46
|
+
weighted_data = normalized_data * weights
|
|
47
|
+
|
|
48
|
+
ideal_best = []
|
|
49
|
+
ideal_worst = []
|
|
50
|
+
|
|
51
|
+
for i in range(len(impacts)):
|
|
52
|
+
if impacts[i] == '+':
|
|
53
|
+
ideal_best.append(weighted_data.iloc[:, i].max())
|
|
54
|
+
ideal_worst.append(weighted_data.iloc[:, i].min())
|
|
55
|
+
else:
|
|
56
|
+
ideal_best.append(weighted_data.iloc[:, i].min())
|
|
57
|
+
ideal_worst.append(weighted_data.iloc[:, i].max())
|
|
58
|
+
|
|
59
|
+
ideal_best = np.array(ideal_best)
|
|
60
|
+
ideal_worst = np.array(ideal_worst)
|
|
61
|
+
|
|
62
|
+
distance_best = np.sqrt(((weighted_data - ideal_best) ** 2).sum(axis=1))
|
|
63
|
+
distance_worst = np.sqrt(((weighted_data - ideal_worst) ** 2).sum(axis=1))
|
|
64
|
+
|
|
65
|
+
topsis_score = distance_worst / (distance_best + distance_worst)
|
|
66
|
+
|
|
67
|
+
df["Topsis Score"] = topsis_score
|
|
68
|
+
df["Rank"] = topsis_score.rank(ascending=False)
|
|
69
|
+
|
|
70
|
+
df.to_csv(output_file, index=False)
|
|
71
|
+
print("Result saved to", output_file)
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: Topsis-Sommit-102303184
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.3
|
|
4
4
|
Summary: TOPSIS implementation using Python
|
|
5
5
|
Author: Sommit
|
|
6
6
|
Author-email: sommit312@gmail.com
|
|
7
|
-
Keywords:
|
|
7
|
+
Keywords: topsis,mcdm,decision making,ranking
|
|
8
8
|
Classifier: Development Status :: 3 - Alpha
|
|
9
9
|
Classifier: Intended Audience :: Education
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
|
11
11
|
Classifier: Operating System :: Microsoft :: Windows
|
|
12
|
-
Classifier: Operating System :: MacOS :: MacOS X
|
|
13
12
|
Classifier: Operating System :: Unix
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Requires-Python: >=3.7
|
|
14
15
|
Description-Content-Type: text/markdown
|
|
15
16
|
License-File: LICENSE
|
|
16
17
|
Requires-Dist: pandas
|
|
@@ -23,6 +24,7 @@ Dynamic: description-content-type
|
|
|
23
24
|
Dynamic: keywords
|
|
24
25
|
Dynamic: license-file
|
|
25
26
|
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
26
28
|
Dynamic: summary
|
|
27
29
|
|
|
28
30
|
# Topsis-Sommit-102303184
|
|
@@ -1,30 +1,31 @@
|
|
|
1
1
|
from setuptools import setup, find_packages
|
|
2
2
|
|
|
3
|
-
with open("README.md", "r", encoding="utf-8") as f:
|
|
4
|
-
long_description = f.read()
|
|
5
|
-
|
|
6
3
|
setup(
|
|
7
|
-
name="Topsis-Sommit-102303184",
|
|
8
|
-
version="0.0.
|
|
4
|
+
name="Topsis-Sommit-102303184", # Package name on PyPI
|
|
5
|
+
version="0.0.3", # Bumped version for new upload
|
|
9
6
|
author="Sommit",
|
|
10
7
|
author_email="sommit312@gmail.com",
|
|
11
8
|
description="TOPSIS implementation using Python",
|
|
12
|
-
long_description=
|
|
9
|
+
long_description=open("README.md", encoding="utf-8").read(),
|
|
13
10
|
long_description_content_type="text/markdown",
|
|
14
11
|
packages=find_packages(),
|
|
15
|
-
install_requires=[
|
|
12
|
+
install_requires=[
|
|
13
|
+
"pandas",
|
|
14
|
+
"numpy"
|
|
15
|
+
],
|
|
16
16
|
entry_points={
|
|
17
17
|
"console_scripts": [
|
|
18
|
-
"topsis=topsis.topsis:main"
|
|
18
|
+
"topsis=topsis.topsis:main" # Creates 'topsis' command in terminal
|
|
19
19
|
]
|
|
20
20
|
},
|
|
21
|
-
keywords=["
|
|
21
|
+
keywords=["topsis", "mcdm", "decision making", "ranking"],
|
|
22
22
|
classifiers=[
|
|
23
23
|
"Development Status :: 3 - Alpha",
|
|
24
24
|
"Intended Audience :: Education",
|
|
25
25
|
"Programming Language :: Python :: 3",
|
|
26
26
|
"Operating System :: Microsoft :: Windows",
|
|
27
|
-
"Operating System :: MacOS :: MacOS X",
|
|
28
27
|
"Operating System :: Unix",
|
|
28
|
+
"Operating System :: MacOS",
|
|
29
29
|
],
|
|
30
|
+
python_requires=">=3.7",
|
|
30
31
|
)
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
import pandas as pd
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
if len(sys.argv) != 5:
|
|
6
|
-
print("Error: Incorrect number of parameters")
|
|
7
|
-
sys.exit(1)
|
|
8
|
-
|
|
9
|
-
input_file = sys.argv[1]
|
|
10
|
-
weights = sys.argv[2].split(',')
|
|
11
|
-
impacts = sys.argv[3].split(',')
|
|
12
|
-
output_file = sys.argv[4]
|
|
13
|
-
|
|
14
|
-
try:
|
|
15
|
-
df = pd.read_csv(input_file)
|
|
16
|
-
except:
|
|
17
|
-
print("Error: File not found")
|
|
18
|
-
sys.exit(1)
|
|
19
|
-
|
|
20
|
-
if df.shape[1] < 3:
|
|
21
|
-
print("Error: Input file must contain three or more columns")
|
|
22
|
-
sys.exit(1)
|
|
23
|
-
|
|
24
|
-
data = df.iloc[:, 1:]
|
|
25
|
-
|
|
26
|
-
try:
|
|
27
|
-
data = data.astype(float)
|
|
28
|
-
except:
|
|
29
|
-
print("Error: From 2nd to last columns must contain numeric values only")
|
|
30
|
-
sys.exit(1)
|
|
31
|
-
|
|
32
|
-
if len(weights) != data.shape[1] or len(impacts) != data.shape[1]:
|
|
33
|
-
print("Error: Number of weights, impacts and columns must be same")
|
|
34
|
-
sys.exit(1)
|
|
35
|
-
|
|
36
|
-
for i in impacts:
|
|
37
|
-
if i not in ['+', '-']:
|
|
38
|
-
print("Error: Impacts must be either + or -")
|
|
39
|
-
sys.exit(1)
|
|
40
|
-
|
|
41
|
-
weights = np.array(weights, dtype=float)
|
|
42
|
-
|
|
43
|
-
norm = np.sqrt((data ** 2).sum())
|
|
44
|
-
normalized_data = data / norm
|
|
45
|
-
weighted_data = normalized_data * weights
|
|
46
|
-
|
|
47
|
-
ideal_best = []
|
|
48
|
-
ideal_worst = []
|
|
49
|
-
|
|
50
|
-
for i in range(len(impacts)):
|
|
51
|
-
if impacts[i] == '+':
|
|
52
|
-
ideal_best.append(weighted_data.iloc[:, i].max())
|
|
53
|
-
ideal_worst.append(weighted_data.iloc[:, i].min())
|
|
54
|
-
else:
|
|
55
|
-
ideal_best.append(weighted_data.iloc[:, i].min())
|
|
56
|
-
ideal_worst.append(weighted_data.iloc[:, i].max())
|
|
57
|
-
|
|
58
|
-
ideal_best = np.array(ideal_best)
|
|
59
|
-
ideal_worst = np.array(ideal_worst)
|
|
60
|
-
|
|
61
|
-
distance_best = np.sqrt(((weighted_data - ideal_best) ** 2).sum(axis=1))
|
|
62
|
-
distance_worst = np.sqrt(((weighted_data - ideal_worst) ** 2).sum(axis=1))
|
|
63
|
-
|
|
64
|
-
topsis_score = distance_worst / (distance_best + distance_worst)
|
|
65
|
-
|
|
66
|
-
df['Topsis Score'] = topsis_score
|
|
67
|
-
df['Rank'] = topsis_score.rank(ascending=False)
|
|
68
|
-
|
|
69
|
-
df.to_csv(output_file, index=False)
|
|
File without changes
|
|
File without changes
|
{topsis_sommit_102303184-0.0.2 → topsis_sommit_102303184-0.0.3}/Topsis_Assignment/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|