code
stringlengths 1
5.19M
| package
stringlengths 1
81
| path
stringlengths 9
304
| filename
stringlengths 4
145
|
---|---|---|---|
from distutils.core import setup
setup(
name = '101703087-topsis', # How you named your package folder (MyLib)
packages = ['topsis'], # Chose the same as "name"
version = '2.0.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'A Python package to choose the best alternative from a finite set of decision alternatives.', # Give a short description about your library
author = 'Anukriti Garg', # Type in your name
author_email = 'anukritigarg13@gmail.com', # Type in your E-Mail
url = 'https://github.com/user/101703087-topsis', # Provide either the link to your github or to your website
download_url = 'https://github.com/anukritigarg13/101703087-topsis/archive/v_2.0.1.tar.gz', # I explain this later on
#keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], # Keywords that define your package best
install_requires=[ # I get to this in a second
"pandas","numpy"
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| 101703087-topsis | /101703087-topsis-2.0.1.tar.gz/101703087-topsis-2.0.1/setup.py | setup.py |
import sys
import os
import pandas as pd
import math
import numpy as np
class Topsis:
def _init_(self,filename):
if os.path.isdir(filename):
head_tail = os.path.split(filename)
data = pd.read_csv(head_tail[1])
if os.path.isfile(filename):
data = pd.read_csv(filename)
self.d = data.iloc[1:,1:].values
self.features = len(self.d[0])
self.samples = len(self.d)
def fun(self,a):
return a[1]
def fun2(self,a):
return a[0]
def evaluate(self,w = None,im = None):
d = self.d
features = self.features
samples = self.samples
if w==None:
w=[1]*features
if im==None:
im=["+"]*features
ideal_best=[]
ideal_worst=[]
for i in range(0,features):
k = math.sqrt(sum(d[:,i]*d[:,i]))
maxx = 0
minn = 1
for j in range(0,samples):
d[j,i] = (d[j,i]/k)*w[i]
if d[j,i]>maxx:
maxx = d[j,i]
if d[j,i]<minn:
minn = d[j,i]
if im[i] == "+":
ideal_best.append(maxx)
ideal_worst.append(minn)
else:
ideal_best.append(minn)
ideal_worst.append(maxx)
p = []
for i in range(0,samples):
a = math.sqrt(sum((d[i]-ideal_worst)*(d[i]-ideal_worst)))
b = math.sqrt(sum((d[i]-ideal_best)*(d[i]-ideal_best)))
lst = []
lst.append(i)
lst.append(a/(a+b))
p.append(lst)
p.sort(key=self.fun)
rank = 1
for i in range(samples-1,-1,-1):
p[i].append(rank)
rank+=1
p.sort(key=self.fun2)
return p
def findTopsis(filename,w,i):
ob = Topsis(filename)
res = ob.evaluate(w,i)
print(res)
def main():
lst = sys.argv
length = len(lst)
if length > 4 or length< 4:
print("wrong Parameters")
else:
w = list(map(int,lst[2].split(',')))
i = lst[3].split(',')
ob = Topsis(lst[1])
res = ob.evaluate(w,i)
print (res)
if _name_ == '_main_':
main() | 101703087-topsis | /101703087-topsis-2.0.1.tar.gz/101703087-topsis-2.0.1/topsis/topsis.py | topsis.py |
from 101703087-topsis.topsis import Topsis | 101703087-topsis | /101703087-topsis-2.0.1.tar.gz/101703087-topsis-2.0.1/topsis/__init__.py | __init__.py |
Outliers
Z-scores(threshold) are the number of standard deviations above and below the mean that each value falls. For example, a Z-score of 2 indicates that an observation is two standard deviations above the average while a Z-score of -2 signifies it is two standard deviations below the mean.For our code , we have selected 3 as Z-score so anything obove it will be considered as an outlier.
This package has been created based on Project 2 of course UCS633.
Anurag Aggarwal COE-4 101703088
| 101703088-outlier | /101703088-outlier-1.0.0.tar.gz/101703088-outlier-1.0.0/README.md | README.md |
from distutils.core import setup
setup(
name = '101703088-outlier', # How you named your package folder (MyLib)
packages = ['outliers'], # Chose the same as "name"
version = '1.0.0', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'A Python package to detect outliers.', # Give a short description about your library
author = 'Anurag Aggarwal', # Type in your name
author_email = 'agrawalanurag321@gmail.com', # Type in your E-Mail
url = 'https://github.com/Anurag-Aggarwal/Outliers', # Provide either the link to your github or to your website
download_url = 'https://github.com/Anurag-Aggarwal/Outliers/archive/V-1.0.0.tar.gz', # I explain this later on
install_requires=[ # I get to this in a second
"numpy"
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
) | 101703088-outlier | /101703088-outlier-1.0.0.tar.gz/101703088-outlier-1.0.0/setup.py | setup.py |
#!/usr/bin/python
import sys
import numpy as np
data = np.genfromtxt(sys.argv[1], delimiter=',')
outliers=[]
def detect_outliers(data):
threshold=3
mean = np.mean(data)
std =np.std(data)
c=0
for i in data:
z_score= (i - mean)/std
if np.abs(z_score) > threshold:
outliers.append(c)
c=c+1
return outliers
out_pt=detect_outliers(data)
print(len(out_pt))
data_o = np.delete(data, out_pt, axis=None)
np.savetxt('data_o.csv', data_o, delimiter=',',fmt='%d') | 101703088-outlier | /101703088-outlier-1.0.0.tar.gz/101703088-outlier-1.0.0/outliers/Outliers.py | Outliers.py |
TOPSIS Package
TOPSIS stands for Technique for Oder Preference by Similarity to Ideal Solution.
It is a method of compensatory aggregation that compares a set of alternatives by identifying weights for each criterion, normalising scores for each criterion and calculating the geometric distance between each alternative and the ideal alternative, which is the best score in each criterion. An assumption of TOPSIS is that the criteria are monotonically increasing or decreasing. In this Python package Vector Normalization has been implemented.
This package has been created based on Project 1 of course UCS633.
Anurag Aggarwal COE-4 101703088
In Command Prompt
>topsis data.csv "1,1,1,1" "+,+,-,+"
| 101703088-topsis | /101703088-topsis-2.0.2.tar.gz/101703088-topsis-2.0.2/README.md | README.md |
from distutils.core import setup
setup(
name = '101703088-topsis', # How you named your package folder (MyLib)
packages = ['topsis'], # Chose the same as "name"
version = '2.0.2', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'A Python package to choose the best alternative from a finite set of decision alternatives.', # Give a short description about your library
author = 'Anurag Aggarwal', # Type in your name
author_email = 'agrawalanurag321@gmail.com', # Type in your E-Mail
url = 'https://github.com/user/101703088-topsis', # Provide either the link to your github or to your website
download_url = 'https://github.com/Anurag-Aggarwal/101703088-topsis/archive/v_2.0.2.tar.gz', # I explain this later on
#keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], # Keywords that define your package best
install_requires=[ # I get to this in a second
"pandas","numpy"
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
) | 101703088-topsis | /101703088-topsis-2.0.2.tar.gz/101703088-topsis-2.0.2/setup.py | setup.py |
import sys
import os
import pandas as pd
import math
import numpy as np
class Topsis:
def _init_(self,filename):
if os.path.isdir(filename):
head_tail = os.path.split(filename)
data = pd.read_csv(head_tail[1])
if os.path.isfile(filename):
data = pd.read_csv(filename)
self.d = data.iloc[1:,1:].values
self.features = len(self.d[0])
self.samples = len(self.d)
def fun(self,a):
return a[1]
def fun2(self,a):
return a[0]
def evaluate(self,w = None,im = None):
d = self.d
features = self.features
samples = self.samples
if w==None:
w=[1]*features
if im==None:
im=["+"]*features
ideal_best=[]
ideal_worst=[]
for i in range(0,features):
k = math.sqrt(sum(d[:,i]*d[:,i]))
maxx = 0
minn = 1
for j in range(0,samples):
d[j,i] = (d[j,i]/k)*w[i]
if d[j,i]>maxx:
maxx = d[j,i]
if d[j,i]<minn:
minn = d[j,i]
if im[i] == "+":
ideal_best.append(maxx)
ideal_worst.append(minn)
else:
ideal_best.append(minn)
ideal_worst.append(maxx)
p = []
for i in range(0,samples):
a = math.sqrt(sum((d[i]-ideal_worst)*(d[i]-ideal_worst)))
b = math.sqrt(sum((d[i]-ideal_best)*(d[i]-ideal_best)))
lst = []
lst.append(i)
lst.append(a/(a+b))
p.append(lst)
p.sort(key=self.fun)
rank = 1
for i in range(samples-1,-1,-1):
p[i].append(rank)
rank+=1
p.sort(key=self.fun2)
return p
def findTopsis(filename,w,i):
ob = Topsis(filename)
res = ob.evaluate(w,i)
print(res)
def main():
lst = sys.argv
length = len(lst)
if length > 4 or length< 4:
print("wrong Parameters")
else:
w = list(map(int,lst[2].split(',')))
i = lst[3].split(',')
ob = Topsis(lst[1])
res = ob.evaluate(w,i)
print (res)
if _name_ == '_main_':
main() | 101703088-topsis | /101703088-topsis-2.0.2.tar.gz/101703088-topsis-2.0.2/topsis/topsis.py | topsis.py |
from 101703088-topsis.topsis import Topsis | 101703088-topsis | /101703088-topsis-2.0.2.tar.gz/101703088-topsis-2.0.2/topsis/__init__.py | __init__.py |
from distutils.core import setup
setup(
name = '101703105', # How you named your package folder (MyLib)
packages = ['101703105'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'Missing', # Give a short description about your library
author = 'Arushi', # Type in your name
author_email = 'arushi0830@gmail.com', # Type in your E-Mail
url = 'https://github.com/arushi0830?tab=repositories', # Provide either the link to your github or to your website
download_url = 'https://github.com/arushi0830/missing/archive/v_01.tar.gz', # I explain this later on
keywords = ['missing', 'values','dataframe'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'numpy',
'pandas',
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| 101703105 | /101703105-0.1.tar.gz/101703105-0.1/setup.py | setup.py |
#Topsis Package
A Python package to implement topsis on a given dataset.
##Usage
Following query on terminal will provide you the best and worst decisions for the dataset.
```
python topsis.py dataset_sample.csv 1,1,1,1 0,1,1,0
``` | 101703196-topsis | /101703196_topsis-1.0.0.tar.gz/101703196_topsis-1.0.0/README.md | README.md |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="101703196_topsis", # Replace with your own username
version="1.0.0",
author="Guneesha Sehgal",
author_email="guneeshasehgal@gmail.com",
description="topsis implementation",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/guneesha12/101703196_topsis/tree/v_1.0.0",
download_url="https://github.com/guneesha12/101703196_topsis/archive/v_1.0.0.tar.gz",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
| 101703196-topsis | /101703196_topsis-1.0.0.tar.gz/101703196_topsis-1.0.0/setup.py | setup.py |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 10 19:57:33 2020
@author: hp
"""
import sys
import os
import pandas as pd
import math
import numpy as np
class Topsis:
def __init__(self,filename):
if os.path.isdir(filename):
head_tail = os.path.split(filename)
data = pd.read_csv(head_tail[1])
if os.path.isfile(filename):
data = pd.read_csv(filename)
self.d = data.iloc[1:,1:].values
self.features = len(self.d[0])
self.samples = len(self.d)
def fun(self,a):
return a[1]
def fun2(self,a):
return a[0]
def evaluate(self,w = None,im = None):
d = self.d
features = self.features
samples = self.samples
if w==None:
w=[1]*features
if im==None:
im=["+"]*features
ideal_best=[]
ideal_worst=[]
for i in range(0,features):
k = math.sqrt(sum(d[:,i]*d[:,i]))
maxx = 0
minn = 1
for j in range(0,samples):
d[j,i] = (d[j,i]/k)*w[i]
if d[j,i]>maxx:
maxx = d[j,i]
if d[j,i]<minn:
minn = d[j,i]
if im[i] == "+":
ideal_best.append(maxx)
ideal_worst.append(minn)
else:
ideal_best.append(minn)
ideal_worst.append(maxx)
p = []
for i in range(0,samples):
a = math.sqrt(sum((d[i]-ideal_worst)*(d[i]-ideal_worst)))
b = math.sqrt(sum((d[i]-ideal_best)*(d[i]-ideal_best)))
lst = []
lst.append(i)
lst.append(a/(a+b))
p.append(lst)
p.sort(key=self.fun)
rank = 1
for i in range(samples-1,-1,-1):
p[i].append(rank)
rank+=1
p.sort(key=self.fun2)
return p
def findTopsis(filename,w,i):
ob = Topsis(filename)
res = ob.evaluate(w,i)
print(res)
def main():
lst = sys.argv
length = len(lst)
if length > 4 or length< 4:
print("wrong Parameters")
else:
w = list(map(int,lst[2].split(',')))
i = lst[3].split(',')
ob = Topsis(lst[1])
res = ob.evaluate(w,i)
print (res)
if __name__ == '__main__':
main()
| 101703196-topsis | /101703196_topsis-1.0.0.tar.gz/101703196_topsis-1.0.0/topsis/topsis.py | topsis.py |
from topsis.topsis import Topsis | 101703196-topsis | /101703196_topsis-1.0.0.tar.gz/101703196_topsis-1.0.0/topsis/__init__.py | __init__.py |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 14:11:37 2020
@author: Harmeet Kaur
"""
from distutils.core import setup
setup(
name = '101703214_assign1_UCS633', # How you named your package folder (MyLib)
packages = ['101703214_assign1_UCS633'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='mit', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'TYPE YOUR DESCRIPTION HERE', # Give a short description about your library
author = 'Harmeet kaur', # Type in your name
author_email = 'kaur.harmeet511@gmail.com', # Type in your E-Mail
url = 'https://github.com/harmeet511/101703214_assign1_UCS633', # Provide either the link to your github or to your website
download_url = 'https://github.com/harmeet511/101703214_assign1_UCS633/archive/v_01.tar.gz', # I explain this later on
keywords = ['topsis', 'ucs633'], # Keywords that define your package best
install_requires=['numpy' ], # I get to this in a second
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| 101703214-assign1-UCS633 | /101703214_assign1_UCS633-0.1.tar.gz/101703214_assign1_UCS633-0.1/setup.py | setup.py |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 12:52:19 2020
@author: Harmeet Kaur
"""
"""n=int(input())
m=int(input())
a=[[int(input()) for x in range(m)] for y in range (n)]
w=[float(input()) for x in range(m)]
need=[int(input()) for x in range(m)]"""
import numy as np
def normalized_matrix(a):
sum1=[]
attributes=len(a)
models=len(a[0])
for i in range(models):
sum2=0
for j in range(attributes):
sum2+=a[j][i]*a[j][i]
sum1.append(sum2)
for i in range(models):
for j in range(attributes):
a[j][i]=a[j][i]/sum1[j]
return a
def setting_weights(a,w):
attributes=len(a)
models=len(a[0])
for i in range(attributes):
for j in range(models):
a[i][j]=a[i][j]*w[j]
return a
def cal_ideal_post(a,req_class):
attributes=len(a)
models=len(a[0])
v_positive=[]
maxi=0
mini=1e9
for i in range(models):
for j in range(attributes):
if(req_class[i]==1):
maxi=max(maxi,a[j][i])
else:
mini=min(mini,a[j][i])
if(req_class[i]==1):
v_positive.append(maxi)
else:
v_positive.append(mini)
return v_positive
def cal_ideal_neg(a,req_class):
attributes=len(a)
models=len(a[0])
v_neg=[]
maxi=0
mini=1e9
for i in range(models):
for j in range(attributes):
if(req_class[i]==0):
maxi=max(maxi,a[j][i])
else:
mini=min(mini,a[j][i])
if(req_class[i]==1):
v_neg.append(mini)
else:
v_neg.append(maxi)
return v_neg
def separation_positive(a,vg):
attributes=len(a)
models=len(a[0])
sg=[]
for i in range(attributes):
sum1=0
for j in range(models):
sum1+=(vg[i]-a[i][j])**2
sg.append(sum1**0.5)
return sg
def separation_negative(a,vb):
attributes=len(a)
models=len(a[0])
sb=[]
for i in range(attributes):
sum1=0
for j in range(models):
sum1+=(vb[i]-a[i][j])**2
sb.append(sum1**0.5)
return sb
def relative_closeness(sg,sb):
n1=len(sg)
p=[]
for i in range(n1):
p.append(sb[i]/(sg[i]+sb[i]))
return p
def final_ranking(p):
n1=len(p)
k=p
k.sort()
dicti={}
for i in range(0,n1):
dicti[k[i]]=n1-i
for j in range(n1):
p[j]=dicti[p[j]]
return p
def topsis(a,w,req_class):
a=normalized_matrix(a)
a=setting_weights(a,w)
vg=cal_ideal_post(a,req_class)
vb=cal_ideal_neg(a,req_class)
sg=separation_positive(a,vg)
sb=separation_negative(a,vb)
p=relative_closeness(sg,sb)
ranking=final_ranking(p)
return ranking
| 101703214-assign1-UCS633 | /101703214_assign1_UCS633-0.1.tar.gz/101703214_assign1_UCS633-0.1/101703214_assign1_UCS633/assign1.py | assign1.py |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 13:44:56 2020
@author: Harmeet Kaur
"""
from 101703214_assign1_UCS633.assign1 import normalized_matrix,setting_weights,cal_ideal_post,cal_ideal_neg\
separation_positive,separation_negative,relative_closeness,final_ranking | 101703214-assign1-UCS633 | /101703214_assign1_UCS633-0.1.tar.gz/101703214_assign1_UCS633-0.1/101703214_assign1_UCS633/__init__.py | __init__.py |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
import sys
def file(input_file):
try:
return pd.read_csv(input_file)
except IOError:
raise Exception("Data file doesn't exist\n")
def main():
filename = sys.argv[1]
data=file(filename)
imputer=SimpleImputer(missing_values=np.nan,strategy='mean')
data=pd.DataFrame(imputer.fit_transform(data))
data.to_csv('new_data.csv',index=False)
print("New data is saved to file 'new_data.csv'.")
| 101703235-missing-val | /101703235_missing_val-0.0.1-py3-none-any.whl/hit_miss/hit_val.py | hit_val.py |
# | 101703235-missing-val | /101703235_missing_val-0.0.1-py3-none-any.whl/hit_miss/__init__.py | __init__.py |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
import sys
def file(input_file):
try:
return pd.read_csv(input_file)
except IOError:
raise Exception("Data file doesn't exist\n")
def main():
filename = sys.argv[1]
data=file(filename)
imputer=SimpleImputer(missing_values=np.nan,strategy='mean')
data=pd.DataFrame(imputer.fit_transform(data))
data.to_csv('new_data.csv',index=False)
print("New data is saved to file 'new_data.csv'.")
| 101703272-missing-val | /101703272_missing_val-0.0.1-py3-none-any.whl/jyot_val/val_miss.py | val_miss.py |
# | 101703272-missing-val | /101703272_missing_val-0.0.1-py3-none-any.whl/jyot_val/__init__.py | __init__.py |
import sys
import numpy as np
import pandas as pd
import os
import csv
from sklearn.linear_model import LinearRegression
def helper():
path_file = os.getcwd() + '/' + sys.argv[1]
data = pd.read_csv(path_file)
def f1(s):
if s == "male":
return 0
elif s == "female":
return 1
else:
return np.nan
def f2(s):
if s == "S":
return 0
elif s == "Q":
return 1
elif s == "C":
return 2
else:
return np.nan
data["Sex_numeric"] = data.Sex.apply(f1)
data["Embarked_numeric"] = data.Embarked.apply(f2)
del data["Sex"]
del data["Embarked"]
del data["Cabin"]
del data["PassengerId"]
del data["Ticket"]
del data["Name"]
data2 = data.copy()
a = data2.isnull().sum()
l = data2.isnull().sum()[a > 0].index#Null Columns
nl = data2.isnull().sum()[a == 0].index#Non Null Columns
selected_rows = data2.loc[:,"Age"].isnull() == False
x_train = data2.loc[selected_rows, nl].values
y_train = data2.loc[selected_rows, "Age"].values
selected_rows = (selected_rows == False)#This is way of taking negation
x_test = data2.loc[selected_rows, nl].values
lr = LinearRegression()
lr.fit(x_train, y_train)
data2.loc[selected_rows, "Age"] = lr.predict(x_test)
print(data2.isnull().sum())
a = data2.isnull().sum()
l = data2.isnull().sum()[a > 0].index
nl = data2.isnull().sum()[a == 0].index
selected_rows = data2.loc[:, "Embarked_numeric"].isnull() == False
x_train = data2.loc[selected_rows,nl].values
y_train = data2.loc[selected_rows, "Embarked_numeric"].values
selected_rows = (selected_rows == False)
x_test = data2.loc[selected_rows, nl].values
lr = LinearRegression()
lr.fit(x_train, y_train)
data2.loc[selected_rows,"Embarked_numeric"] = lr.predict(x_test)
#Undo the operations
def f11(s):
if s == 0.0:
return "male"
else:
return "female"
def f22(s):
if s == 0.0:
return "S"
elif s == 1.0:
return "Q"
else:
return "C"
data2["Sex"] = data2.Sex_numeric.apply(f11)
data2["Embarked"] = data2.Embarked_numeric.apply(f22)
del data2["Embarked_numeric"]
del data2["Sex_numeric"]
final_path = os.getcwd() + '/' + 'Missing.csv'
data2.to_csv(final_path)
return 1;
def main():
if(len(sys.argv) != 2):
print("Operation failed")
return sys.exit(1)
else:
a = helper()
if(a == 1):
print("Task Complete")
if __name__ == '__main__':
main()
| 101703311-Missing-Data | /101703311_Missing_Data-1.0.1-py3-none-any.whl/data/handledata.py | handledata.py |
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 20 16:06:07 2020
@author: Lokesh Arora
"""
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="101703311_OUTLIERS",
version="1.0.2",
author="Lokesh Arora",
author_email="3lokesharora@gmail.com",
description="A python package for removing outliers from a dataset using InterQuartile Range (IQR)",
long_description=long_description,
long_description_content_type="text/markdown",
url="",
License="MIT",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
packages=["Outliers"],
include_package_data=True,
install_requires=["requests"],
entry_points={"console_scripts":["outlierRemoval=Outliers.outlierRemoval:main"]},
)
| 101703311-OUTLIERS | /101703311_OUTLIERS-1.0.2.tar.gz/101703311_OUTLIERS-1.0.2/setup.py | setup.py |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 11 22:14:38 2020
@author: Lokesh Arora
"""
import sys
import pandas as pd
import numpy as np
def remove_outlier(dataset,file="Final.csv"):
data=pd.read_csv(dataset)
X=data.iloc[:,:-1].values
Y=data.iloc[:,-1].values
numOutliers=0
outliers=[]
initialRows=X.shape[0]
for i in range(np.shape(X)[1]):
temp=[]
for j in range(np.shape(X)[0]):
temp.append(X[j][i])
Q1,Q3=np.percentile(temp,[25,75])
IQR=Q3-Q1
MIN=Q1-(1.5*IQR)
MAX=Q3+(1.5*IQR)
for j in range(0,np.shape(X)[0]):
if(X[j][i]<MIN or X[j][i]>MAX):
numOutliers+=1
outliers.append(j)
X=np.delete(X,outliers,axis=0)
Y=np.delete(Y,outliers,axis=0)
finalRows=X.shape[0]
deleted=initialRows - finalRows
col=list(data.columns)
print('Rows removed={}'.format(deleted))
newdata={}
j=0
for i in range(len(col)-1):
newdata[col[i]]=X[:,j]
j+=1
newdata[col[len(col)-1]]=Y
new=pd.DataFrame(newdata)
new.to_csv(file,index=False)
def main():
if len (sys.argv) <2 :
print("Arguements not valid")
sys.exit (1)
if len(sys.argv)>3:
print("Arguments not valid")
sys.exit(1)
file1=sys.argv[1]
final=""
if len(sys.argv)==3:
final=sys.argv[2]
else:
final="OutlierRemoved"+file1
if(remove_outlier(file1,final)==None):
print("Successfully executed")
if __name__=='__main__':
main()
| 101703311-OUTLIERS | /101703311_OUTLIERS-1.0.2.tar.gz/101703311_OUTLIERS-1.0.2/Outliers/outlierRemoval.py | outlierRemoval.py |
import sys
import pandas as pd
import numpy as np
def remove_outlier(dataset,file="Final.csv"):
data=pd.read_csv(dataset)
X=data.iloc[:,:-1].values
Y=data.iloc[:,-1].values
numOutliers=0
outliers=[]
initialRows=X.shape[0]
for i in range(np.shape(X)[1]):
temp=[]
for j in range(np.shape(X)[0]):
temp.append(X[j][i])
Q1,Q3=np.percentile(temp,[25,75])
IQR=Q3-Q1
MIN=Q1-(1.5*IQR)
MAX=Q3+(1.5*IQR)
for j in range(0,np.shape(X)[0]):
if(X[j][i]<MIN or X[j][i]>MAX):
numOutliers+=1
outliers.append(j)
X=np.delete(X,outliers,axis=0)
Y=np.delete(Y,outliers,axis=0)
finalRows=X.shape[0]
deleted=initialRows - finalRows
col=list(data.columns)
print('Rows removed={}'.format(deleted))
newdata={}
j=0
for i in range(len(col)-1):
newdata[col[i]]=X[:,j]
j+=1
newdata[col[len(col)-1]]=Y
new=pd.DataFrame(newdata)
new.to_csv(file,index=False)
def main():
if len (sys.argv) <2 :
print("Invalid number of arguements passed:atleast 1(source file name) and atmost two(source file name, destination file name) arguements are permitted")
sys.exit (1)
if len(sys.argv)>3:
print("Invalid number of arguements passed:atleast 1(source file name) and atmost two(source file name, destination file name) arguements are permitted")
sys.exit(1)
file1=sys.argv[1]
final=""
if len(sys.argv)==3:
final=sys.argv[2]
else:
final="OutlierRemoved"+file1
if(remove_outlier(file1,final)==None):
print("Successfully executed")
if __name__=='__main__':
main()
| 101703312-outlierRemoval | /101703312_outlierRemoval-1.0.0-py3-none-any.whl/outlier_python/outlierRemoval.py | outlierRemoval.py |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
import sys
def file(input_file):
try:
return pd.read_csv(input_file)
except IOError:
raise Exception("Data file doesn't exist\n")
def main():
filename = sys.argv[1]
data=file(filename)
imputer=SimpleImputer(missing_values=np.nan,strategy='mean')
data=pd.DataFrame(imputer.fit_transform(data))
data.to_csv('new_data.csv',index=False)
print("New data is saved to file 'new_data.csv'.")
| 101703322-missing-val | /101703322_missing_val-0.0.1-py3-none-any.whl/manav_val/val_manav.py | val_manav.py |
# | 101703322-missing-val | /101703322_missing_val-0.0.1-py3-none-any.whl/manav_val/__init__.py | __init__.py |
Outliers
Z-scores(threshold) are the number of standard deviations above and below the mean that each value falls. For example, a Z-score of 2 indicates that an observation is two standard deviations above the average while a Z-score of -2 signifies it is two standard deviations below the mean.For our code , we have selected 3 as Z-score so anything obove it will be considered as an outlier.
This package has been created based on Project 2 of course UCS633.
Nikhil Vyas COE-17 101703373
| 101703373-outlier | /101703373-outlier-1.0.0.tar.gz/101703373-outlier-1.0.0/README.md | README.md |
from distutils.core import setup
setup(
name = '101703373-outlier', # How you named your package folder (MyLib)
packages = ['outliers'], # Chose the same as "name"
version = '1.0.0', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'A Python package to detect outliers.', # Give a short description about your library
author = 'Nikhil Vyas', # Type in your name
author_email = 'vyasnikhil30@gmail.com', # Type in your E-Mail
url = 'https://github.com/vyasnikhil/Outliers-10173373', # Provide either the link to your github or to your website
download_url = 'https://github.com/vyasnikhil/Outliers-10173373/archive/V_1.0.0.tar.gz', # I explain this later on
install_requires=[ # I get to this in a second
"numpy"
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
) | 101703373-outlier | /101703373-outlier-1.0.0.tar.gz/101703373-outlier-1.0.0/setup.py | setup.py |
#!/usr/bin/python
import sys
import numpy as np
data = np.genfromtxt(sys.argv[1], delimiter=',')
outliers=[]
def detect_outliers(data):
threshold=3
mean = np.mean(data)
std =np.std(data)
c=0
for i in data:
z_score= (i - mean)/std
if np.abs(z_score) > threshold:
outliers.append(c)
c=c+1
return outliers
out_pt=detect_outliers(data)
print(len(out_pt))
data_o = np.delete(data, out_pt, axis=None)
np.savetxt('data_o.csv', data_o, delimiter=',',fmt='%d') | 101703373-outlier | /101703373-outlier-1.0.0.tar.gz/101703373-outlier-1.0.0/outliers/Outliers.py | Outliers.py |
import sys
import os
import pandas as pd
import math
import numpy as np
class Topsis:
def _init_(self,filename):
if os.path.isdir(filename):
head_tail = os.path.split(filename)
data = pd.read_csv(head_tail[1])
if os.path.isfile(filename):
data = pd.read_csv(filename)
self.d = data.iloc[1:,1:].values
self.features = len(self.d[0])
self.samples = len(self.d)
def fun(self,a):
return a[1]
def fun2(self,a):
return a[0]
def evaluate(self,w = None,im = None):
d = self.d
features = self.features
samples = self.samples
if w==None:
w=[1]*features
if im==None:
im=["+"]*features
ideal_best=[]
ideal_worst=[]
for i in range(0,features):
k = math.sqrt(sum(d[:,i]*d[:,i]))
maxx = 0
minn = 1
for j in range(0,samples):
d[j,i] = (d[j,i]/k)*w[i]
if d[j,i]>maxx:
maxx = d[j,i]
if d[j,i]<minn:
minn = d[j,i]
if im[i] == "+":
ideal_best.append(maxx)
ideal_worst.append(minn)
else:
ideal_best.append(minn)
ideal_worst.append(maxx)
p = []
for i in range(0,samples):
a = math.sqrt(sum((d[i]-ideal_worst)*(d[i]-ideal_worst)))
b = math.sqrt(sum((d[i]-ideal_best)*(d[i]-ideal_best)))
lst = []
lst.append(i)
lst.append(a/(a+b))
p.append(lst)
p.sort(key=self.fun)
rank = 1
for i in range(samples-1,-1,-1):
p[i].append(rank)
rank+=1
p.sort(key=self.fun2)
return p
def findTopsis(filename,w,i):
ob = Topsis(filename)
res = ob.evaluate(w,i)
print(res)
def main():
lst = sys.argv
length = len(lst)
if length > 4 or length< 4:
print("wrong Parameters")
else:
w = list(map(int,lst[2].split(',')))
i = lst[3].split(',')
ob = Topsis(lst[1])
res = ob.evaluate(w,i)
print (res)
if _name_ == '_main_':
main()
| 101703373-topsis | /101703373_topsis-1.0.0-py3-none-any.whl/topsis/101703373-topsis.py | 101703373-topsis.py |
# A library capable of removing outliers from a pandas dataframe
```
PROJECT 2, UCS633 - Data Analysis and Visualization
Nishant Dhanda
COE17
Roll number: 101703375
```
| 101703375-p2 | /101703375_p2-0.1.0.tar.gz/101703375_p2-0.1.0/README.md | README.md |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="101703375_p2",
version="0.1.0",
author="Nishant Dhanda",
author_email="ndhanda_be17@thapar.edu",
description="Removal of outliers using pandas",
url='https://github.com/NishantDhanda/101703375_p2/',
long_description=long_description,
long_description_content_type="text/markdown",
packages=setuptools.find_packages(),
scripts=['bin/outcli'],
keywords = ['CLI', 'OUTLIER', 'Data'],
python_requires='>=3.6',
)
| 101703375-p2 | /101703375_p2-0.1.0.tar.gz/101703375_p2-0.1.0/setup.py | setup.py |
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 19:27:00 2020
@author: Nishant
"""
import numpy as np
import pandas as pd
def outliers_detection(input_csv_file, output_csv_file):
dataset1 = pd.read_csv(input_csv_file)
dataset2 = dataset1.iloc[:,1:]
for ind, row in dataset2.iterrows():
threshold = 3
mean = np.mean(row)
std_dev = np.std(row)
for value in row:
z_score = (value-mean)/std_dev
if np.abs(z_score)>threshold:
dataset1 = dataset1.drop(dataset2.index[ind])
break
dataset1.to_csv(output_csv_file, index=False)
print('Number of rows removed are :',len(dataset2) - len(dataset1))
| 101703375-p2 | /101703375_p2-0.1.0.tar.gz/101703375_p2-0.1.0/outlib/p2.py | p2.py |
import sys
from pro2.models import outliers
def main():
sysarglist = sys.argv
sysarglist.pop(0)
assert len(sysarglist) == 2, "Insufficient number of arguments provided"
filename_in = sysarglist[0]
filename_out = sysarglist[1]
assert filename_in, "Input CSV filename must be provided"
assert filename_out, "Output CSV filename must be provided"
outliers(filename_in, filename_out)
| 101703378-project2 | /101703378_project2-0.0.2-py3-none-any.whl/pro2/outcli.py | outcli.py |
import numpy as np
import pandas as pd
def outliers(incsv_file, outcsv_file):
dataset = pd.read_csv(incsv_file)
Q1 = dataset.quantile(0.25)
Q3 = dataset.quantile(0.75)
IQR = Q3 - Q1
new_dataset = dataset[((dataset >= (Q1 - 1.5 * IQR)) &(dataset <= (Q3 + 1.5 * IQR))).all(axis=1)]
new_dataset.to_csv(outcsv_file, index=False)
print('The no of rows removed:',len(dataset) - len(new_dataset))
| 101703378-project2 | /101703378_project2-0.0.2-py3-none-any.whl/pro2/models.py | models.py |
from distutils.core import setup
setup(
name = '101703381-outlier', # How you named your package folder (MyLib)
packages = ['101703381-outlier'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'outlier removal using z score', # Give a short description about your library
author = 'palki', # Type in your name
author_email = 'palkipb@gmail.com', # Type in your E-Mail
url = 'https://github.com/palkibansal31/Z_Score', # Provide either the link to your github or to your website
download_url = 'https://github.com/palkibansal31/Z_Score/archive/v_01.tar.gz', # I explain this later on
keywords = ['outlier'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'numpy',
'pandas',
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
) | 101703381-outlier | /101703381-outlier-0.1.tar.gz/101703381-outlier-0.1/setup.py | setup.py |
#importing libraries
import numpy as np
import pandas as pd
def outliers_removal(in_file, out_file):
dataset = pd.read_csv(in_file)
#calculating 25th and 75th percentile
Q1 = dataset.quantile(0.25)
Q3 = dataset.quantile(0.75)
#calculating Inter Quartile range
IQR = Q3 - Q1
new_dataset = dataset[((dataset >= (Q1 - 1.5 * IQR)) &(dataset <= (Q3 + 1.5 * IQR))).all(axis=1)]
new_dataset.to_csv(out_file, index=False)
print('The no of rows removed:',len(dataset) - len(new_dataset))
| 101703383-python-package2 | /101703383_python_package2-0.0.3-py3-none-any.whl/package/code_file.py | code_file.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 20 02:30:00 2020
@author: samikshakapoor
"""
from distutils.core import setup
setup(
name = '101703476_samiksha', # How you named your package folder (MyLib)
packages = ['101703476_samiksha'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'topsis', # Give a short description about your library
author = 'samiksha kapoor', # Type in your name
author_email = 'samiksha9914@gmail.com', # Type in your E-Mail
url = 'https://github.com/samii9914/TOPSIS', # Provide either the link to your github or to your website
download_url = 'https://github.com/user/reponame/archive/v_01.tar.gz', # I explain this later on
keywords = ['python', 'topsis', 'KEYWORDS'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'validators',
'beautifulsoup4',
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| 101703476-samiksha | /101703476_samiksha-0.1.tar.gz/101703476_samiksha-0.1/setup.py | setup.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 19 18:08:36 2020
@author: samikshakapoor
"""
import pandas as pd
import sys
import numpy as np
def main():
dataset = pd.read_csv(sys.argv[1]).values #import the dataset
weights = [int(i) for i in sys.argv[2].split(',')] #initalize the weights array entered by user
impacts = sys.argv[3].split(',')
topsis(dataset , weights , impacts) #initalize impacts array entered by user
#dataset = [[250,16,12,5],[200,16,8,3],[300,32,16,4],[275,32,8,4],[225,16,16,2]]
#output = pd.DataFrame(dataset)
#w = [.25,.25,.25,.25]
#beni = ['-','+','+','+']
def topsis(dataset,weights,benificiary):
#importing libraries
import math
# print(dataset)
output=pd.DataFrame(dataset)
a = (output.shape)
#print(output)
rows = a[0]
columns = a[1]
# print(a)
#normalizing the dataset
# dataset = pd.DataFrame(dataset)
# dataset.astype('float')
# dataset.to_numpy()
dataset=np.array(dataset).astype('float32')
for i in range(0,columns):
Fsum=0
for j in range(0,rows):
Fsum += dataset[j][i]*dataset[j][i]
Fsum = math.sqrt(Fsum)
for j in range(0,rows):
dataset[j][i] = dataset[j][i]/Fsum
# print(dataset)
# print(Fsum)
#multipling with weights
for x in range(0,columns):
for y in range(0,rows):
dataset[y][x] *= weights[x]
#finding worst and best of each column
#print(dataset)
vPlus = []
vMinus = []
def findMin(x,rows):
m = 100
for i in range(0,rows):
if(dataset[i][x]<m):
m=dataset[i][x]
return m
def findMax(x,rows):
m = -1
for i in range(0,rows):
if(dataset[i][x]>m):
m=dataset[i][x]
return m
for x in range(0,columns):
if(benificiary[x]=='+'):
vPlus.append(findMax(x,rows))
vMinus.append(findMin(x,rows))
else:
vPlus.append(findMin(x,rows))
vMinus.append(findMax(x,rows))
#calculatind the s+ and s- values
#computing the performance score for each row
def svalue(a,b):
sub = a-b
ans = sub**2
return ans
p = []
#print(vPlus)
#print(vMinus)
for i in range(0,rows):
sum1 = 0
sum2 = 0
for j in range(0,columns):
sum1 = sum1+svalue(dataset[i][j],vPlus[j])
sum2 = sum2+svalue(dataset[i][j],vMinus[j])
sum1 = math.sqrt(sum1)
sum2 = math.sqrt(sum2)
# print(sum1)
# print(sum2)
# print("*****")
p.append(sum2/(sum1+sum2))
output['performance score'] = p
rank = [0 for x in range(rows)]
count=1
q = p.copy()
for i in range(0,rows):
maxpos = q.index(max(q))
rank[maxpos] = count
count=count+1
q[maxpos]=-1
output['rank'] = rank
print(output)
return output
if __name__=="__main__":
main() | 101703476-samiksha | /101703476_samiksha-0.1.tar.gz/101703476_samiksha-0.1/101703476_samiksha/topsis.py | topsis.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 26 21:05:33 2020
@author: samikshakapoor
"""
from 101703476_samiksha.topsis import topsis
| 101703476-samiksha | /101703476_samiksha-0.1.tar.gz/101703476_samiksha-0.1/101703476_samiksha/__init__.py | __init__.py |
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import pandas as pd
import numpy as np
from sklearn.impute import SimpleImputer
import sys
def file(input_file):
try:
return pd.read_csv(input_file)
except IOError:
raise Exception("Data file doesn't exist\n")
def main():
filename = sys.argv[1]
data=file(filename)
imputer=SimpleImputer(missing_values=np.nan,strategy='mean')
data=pd.DataFrame(imputer.fit_transform(data))
data.to_csv('new_data.csv',index=False)
print("New data is saved to file 'new_data.csv'.")
| 101703549-missing-val | /101703549_missing_val-0.0.1-py3-none-any.whl/sin_miss/miss_val.py | miss_val.py |
# | 101703549-missing-val | /101703549_missing_val-0.0.1-py3-none-any.whl/sin_miss/__init__.py | __init__.py |
# Filling Missing Values
Missing Data can occur when no information is provided for one or more items or for a whole unit. Missing Data is a very big problem in real life scenario. Missing Data can also refer to as `NA`(Not Available) values in pandas. In DataFrame sometimes many datasets simply arrive with missing data, either because it exists and was not collected or it never existed.
In this package, the missing values in a csv file are filled using the fillna function in pandas. For this the statistical model of mean is used.
## Usage
$ python3 missing.py filename
| 101703573-Missing-pkg-suruchipundir | /101703573_Missing-pkg-suruchipundir-0.0.1.tar.gz/101703573_Missing-pkg-suruchipundir-0.0.1/README.md | README.md |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="101703573_Missing-pkg-suruchipundir",
version="0.0.1",
author="Suruchi Pundir",
author_email="suruchipundir@gmail.com",
description="Python package to handle missing data",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/suruchipundir/missing-data",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
],
python_requires='>=3.6',
)
| 101703573-Missing-pkg-suruchipundir | /101703573_Missing-pkg-suruchipundir-0.0.1.tar.gz/101703573_Missing-pkg-suruchipundir-0.0.1/setup.py | setup.py |
from distutils.core import setup
setup(
name = '101703604_topsis', # How you named your package folder (MyLib)
packages = ['101703604_topsis'], # Chose the same as "name"
version = '0.1', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'A Python package to get the best out of various features.', # Give a short description about your library
author = 'Vanshika Chowdhary', # Type in your name
author_email = 'vchowdhary_be17@thapar.edu', # Type in your E-Mail
url = 'https://github.com/vchowdhary21', # Provide either the link to your github or to your website
download_url = 'https://github.com/user/reponame/archive/v_01.tar.gz', # I explain this later on
keywords = ['SOME', 'MEANINGFULL', 'KEYWORDS'], # Keywords that define your package best
install_requires=[ 'numpy',
'pandas', # I get to this in a second
'validators',
'beautifulsoup4',
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| 101703604-topsis | /101703604_topsis-0.1.tar.gz/101703604_topsis-0.1/setup.py | setup.py |
import numpy as np
import pd as pd
def topsis(d,w,t):
fd = d.copy()
n = len(d.axes[0])
m = len(d.axes[1])
d = d.astype(dtype='float')
d=d.values
for j in range(m):
s=0
for i in range(n):
s+=d[i][j]*d[i][j]
s = s**0.5
for i in range(n):
d[i][j]=float(d[i][j])/float(s)
for j in range(m):
for i in range(n):
d[i][j]=d[i][j]*w[j]
v1=[]
v2=[]
for j in range(m):
if t[j]=='+':
v1.append(max(d[:,j]))
v2.append(min(d[:,j]))
else:
v1.append(min(d[:,j]))
v2.append(max(d[:,j]))
p1=[]
p2=[]
for i in range(n):
s1=0
s2=0
for j in range(m):
s1+=(d[i][j]-v1[j])*(d[i][j]-v1[j])
s2+=(d[i][j]-v2[j])*(d[i][j]-v2[j])
s1 = s1**0.5
s2 = s2**0.5
p1.append(s1)
p2.append(s2)
r = []
for i in range(n):
k = p2[i]/(p1[i]+p2[i])
r.append(k)
fd['Performance'] = r
fd['Rank'] = fd['Performance'].rank(ascending=False)
print(fd)
| 101703604-topsis | /101703604_topsis-0.1.tar.gz/101703604_topsis-0.1/101703604_topsis/101703604_topsis.py | 101703604_topsis.py |
from distutils.core import setup
setup(
name = '101903683_kunal_topsis',
packages = ['101903683_kunal_topsis'],
version = 'v1.2',
license='MIT',
description = '',
author = 'Kunal Garg',
author_email = 'kgarg2_be19@thapar.edu',
url = 'https://github.com/Gargkunal02/101903683_kunal_topsis',
download_url = '',
keywords = ['topsis','topsis score','rank','Thapar'],
install_requires=['numpy','pandas' ],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
) | 101903683-kunal-topsis | /101903683_kunal_topsis-v1.2.tar.gz/101903683_kunal_topsis-v1.2/setup.py | setup.py |
import sys
import pandas as pd
import numpy as np
def normalized_matrix(filename):
'''To normalize each of the values in the csv file'''
try:
dataset = pd.read_csv(filename) #loading the csv file into dataset
if len(dataset.axes[1])<3:
print("Number of columns should be greater than 3")
sys.exit(1)
attributes = dataset.iloc[:,1:].values
'''the attributes and alternatives are 2-D numpy arrays'''
sum_cols=[0]*len(attributes[0]) #1-D array with size equal to the nummber of columns in the attributes array
for i in range(len(attributes)):
for j in range(len(attributes[i])):
sum_cols[j]+=np.square(attributes[i][j])
for i in range(len(sum_cols)):
sum_cols[i]=np.sqrt(sum_cols[i])
for i in range(len(attributes)):
for j in range(len(attributes[i])):
attributes[i][j]=attributes[i][j]/sum_cols[j]
return (attributes)
except Exception as e:
print(e)
def weighted_matrix(attributes,weights):
''' To multiply each of the values in the attributes array with the corresponding weights of the particular attribute'''
try:
weights=weights.split(',')
for i in range(len(weights)):
weights[i]=float(weights[i])
weighted_attributes=[]
for i in range(len(attributes)):
temp=[]
for j in range(len(attributes[i])):
temp.append(attributes[i][j]*weights[j])
weighted_attributes.append(temp)
return(weighted_attributes)
except Exception as e:
print(e)
def impact_matrix(weighted_attributes,impacts):
try:
impacts=impacts.split(',')
Vjpositive=[]
Vjnegative=[]
for i in range(len(weighted_attributes[0])):
Vjpositive.append(weighted_attributes[0][i])
Vjnegative.append(weighted_attributes[0][i])
for i in range(1,len(weighted_attributes)):
for j in range(len(weighted_attributes[i])):
if impacts[j]=='+':
if weighted_attributes[i][j]>Vjpositive[j]:
Vjpositive[j]=weighted_attributes[i][j]
elif weighted_attributes[i][j]<Vjnegative[j]:
Vjnegative[j]=weighted_attributes[i][j]
elif impacts[j]=='-':
if weighted_attributes[i][j]<Vjpositive[j]:
Vjpositive[j]=weighted_attributes[i][j]
elif weighted_attributes[i][j]>Vjnegative[j]:
Vjnegative[j]=weighted_attributes[i][j]
Sjpositive=[0]*len(weighted_attributes)
Sjnegative=[0]*len(weighted_attributes)
for i in range(len(weighted_attributes)):
for j in range(len(weighted_attributes[i])):
Sjpositive[i]+=np.square(weighted_attributes[i][j]-Vjpositive[j])
Sjnegative[i]+=np.square(weighted_attributes[i][j]-Vjnegative[j])
for i in range(len(Sjpositive)):
Sjpositive[i]=np.sqrt(Sjpositive[i])
Sjnegative[i]=np.sqrt(Sjnegative[i])
Performance_score=[0]*len(weighted_attributes)
for i in range(len(weighted_attributes)):
Performance_score[i]=Sjnegative[i]/(Sjnegative[i]+Sjpositive[i])
return(Performance_score)
except Exception as e:
print(e)
def rank(filename,weights,impacts,resultfilename):
try:
a = normalized_matrix(filename)
c = weighted_matrix(a,weights)
d = impact_matrix(c,impacts)
dataset = pd.read_csv(filename)
dataset['topsis score']=""
dataset['topsis score']=d
copi=d.copy()
copi.sort(reverse=True)
Rank=[]
for i in range(0,len(d)):
temp=d[i]
for j in range(0,len(copi)):
if temp==copi[j]:
Rank.append(j+1)
break
dataset['Rank']=""
dataset['Rank']=Rank
dataset.to_csv(resultfilename,index=False)
except Exception as e:
print(e)
| 101903683-kunal-topsis | /101903683_kunal_topsis-v1.2.tar.gz/101903683_kunal_topsis-v1.2/101903683_kunal_topsis/topsis.py | topsis.py |
from Topsis_Harsimran_101903288.topsis import rank
__version__='v1.2'
| 101903683-kunal-topsis | /101903683_kunal_topsis-v1.2.tar.gz/101903683_kunal_topsis-v1.2/101903683_kunal_topsis/__init__.py | __init__.py |
from setuptools import setup, find_packages
import codecs
import os
VERSION = '0.0.1'
DESCRIPTION = 'Calculating topsis'
# LONG_DESCRIPTION = 'A package that allows to build simple streams of video, audio and camera data.'/
# Setting up
setup(
name="101903688",
version=VERSION,
author="Harindham",
author_email="<harindamsharma18@gmail.com>",
description=DESCRIPTION,
# long_description_content_type="text/markdown",
# long_description=long_description,
packages=find_packages(),
install_requires=['pandas', 'numpy'],
keywords=['python', 'video', 'stream', 'video stream', 'camera stream', 'sockets'],
classifiers=[
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
) | 101903688 | /101903688-0.0.1.tar.gz/101903688-0.0.1/setup.py | setup.py |
import numpy as np
import pandas as pd
import sys
def create_matrix(matrix):
matrix=matrix[:,1:]
return matrix
def normalize(matrix,weight):
column_squared_sum=np.zeros(matrix.shape[1])
for j in range(matrix.shape[1]):
for i in range(matrix.shape[0]):
column_squared_sum[j]+=matrix[i][j]*matrix[i][j]
column_squared_sum[j]=np.sqrt(column_squared_sum[j])
matrix[:,j:j+1]=matrix[:,j:j+1]/column_squared_sum[j]
return normailze_matrix(matrix,weight=np.asarray(weight))
def normailze_matrix( matrix,weight):
totalweight=np.sum(weight)
weight=weight/totalweight
normailze_matrix=weight*matrix
return normailze_matrix
def cases(normailze_matrix,is_max_the_most_desired):
ideal_best=np.zeros(normailze_matrix.shape[1])
ideal_worst = np.zeros(normailze_matrix.shape[1])
for j in range(normailze_matrix.shape[1]):
if is_max_the_most_desired[j]==1:
ideal_best[j]=np.max(normailze_matrix[:,j])
ideal_worst[j] = np.min(normailze_matrix[:, j])
else:
ideal_worst[j] = np.max(normailze_matrix[:, j])
ideal_best[j] = np.min(normailze_matrix[:, j])
return Euclidean(normailze_matrix,ideal_best,ideal_worst)
def Euclidean(matrix, ideal_best,ideal_worst):
euclidean_best=np.zeros(matrix.shape[0])
euclidean_worst=np.zeros(matrix.shape[0])
for i in range(matrix.shape[0]):
eachrowBest=0
eachRowWorst=0
for j in range(matrix.shape[1]):
eachrowBest+=(matrix[i][j]-ideal_best[j])**2
eachRowWorst+= (matrix[i][j] - ideal_worst[j])**2
euclidean_best[i]=np.sqrt(eachrowBest)
euclidean_worst[i]=np.sqrt(eachRowWorst)
return performance_score(matrix,euclidean_best,euclidean_worst)
def performance_score(matrix,euclidean_best,euclidean_worst):
performance=np.zeros(matrix.shape[0])
for i in range( matrix.shape[0]):
performance[i]=euclidean_worst[i]/(euclidean_best[i]+euclidean_worst[i])
return performance
def topsis():
try:
filename=sys.argv[1]
except:
print('please provide 4 arguements as inputData.csv weights impacts outputFile.csv')
sys.exit(1)
try:
weight_input = sys.argv[2]
except:
print('please provide 3 more arguement')
sys.exit(1)
try:
impacts = sys.argv[3]
except:
print('please provide 2 more arguement')
sys.exit(1)
try:
impacts = sys.argv[3]
except:
print('please provide 1 more arguement')
sys.exit(1)
try:
df = pd.read_csv(filename)
except:
print('Could not read the file given by you')
number_columns=len(df.columns)
if number_columns<3:
raise Exception("Less Col")
if len(sys.argv)!=5:
raise Exception("WrongInput")
if df.isnull().sum().sum()>0:
raise Exception("Blank")
outputFileName = sys.argv[4]
matrix = df.values
original_matrix=matrix
try:
impacts_1=list(e for e in impacts.split(','))
impact_final =[]
for i in impacts_1 :
if(i=='+'):
impact_final.append(1)
elif(i=='-'):
impact_final.append(0)
else:
raise Exception('Impacts must be + or -')
except:
print('could not correctly parse correctly impacts arguement ')
try:
weights=list(float(w) for w in weight_input.split(','))
except:
print(" could not correctly parse weigths argument")
matrix=create_matrix(matrix)
normailze_matrix=normalize(matrix,weights)
performance=cases(normailze_matrix,np.asarray(impact_final))
l = list(performance)
rank = [sorted(l, reverse=True).index(x) for x in l]
df['Score'] = performance
df['Rank'] = rank
df['Rank'] = df['Rank'] + 1
df.to_csv(outputFileName)
topsis() | 101903697-Topsis-code | /101903697_Topsis_code-0.0.1-py3-none-any.whl/New folder/101903697.py.py | 101903697.py.py |
from setuptools import setup, find_packages
import codecs
import os
VERSION = '0.0.1'
DESCRIPTION = 'Topsis_code'
LONG_DESCRIPTION = 'A Python package implementing Topsis method sed for multi-criteria decision analysis. Topsis stands for Technique for Order of Preference by Similarity to Ideal Solution'
# Setting up
setup(
name="101903700-Topsis-code",
version=VERSION,
author="Bhavy Garg",
author_email="bgarg1_be19@thapar.edu",
description=DESCRIPTION,
long_description_content_type="text/markdown",
long_description=LONG_DESCRIPTION,
packages=find_packages(),
install_requires=[],
keywords=['topsis','Topsis'],
classifiers=[
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
) | 101903700-Topsis-code | /101903700-Topsis-code-0.0.1.tar.gz/101903700-Topsis-code-0.0.1/setup.py | setup.py |
import numpy as np
import pandas as pd
import sys
def create_matrix(matrix):
matrix=matrix[:,1:]
return matrix
def normalize(matrix,weight):
column_squared_sum=np.zeros(matrix.shape[1])
for j in range(matrix.shape[1]):
for i in range(matrix.shape[0]):
column_squared_sum[j]+=matrix[i][j]*matrix[i][j]
column_squared_sum[j]=np.sqrt(column_squared_sum[j])
matrix[:,j:j+1]=matrix[:,j:j+1]/column_squared_sum[j]
return normailze_matrix(matrix,weight=np.asarray(weight))
def normailze_matrix( matrix,weight):
totalweight=np.sum(weight)
weight=weight/totalweight
normailze_matrix=weight*matrix
return normailze_matrix
def cases(normailze_matrix,is_max_the_most_desired):
ideal_best=np.zeros(normailze_matrix.shape[1])
ideal_worst = np.zeros(normailze_matrix.shape[1])
for j in range(normailze_matrix.shape[1]):
if is_max_the_most_desired[j]==1:
ideal_best[j]=np.max(normailze_matrix[:,j])
ideal_worst[j] = np.min(normailze_matrix[:, j])
else:
ideal_worst[j] = np.max(normailze_matrix[:, j])
ideal_best[j] = np.min(normailze_matrix[:, j])
return Euclidean(normailze_matrix,ideal_best,ideal_worst)
def Euclidean(matrix, ideal_best,ideal_worst):
euclidean_best=np.zeros(matrix.shape[0])
euclidean_worst=np.zeros(matrix.shape[0])
for i in range(matrix.shape[0]):
eachrowBest=0
eachRowWorst=0
for j in range(matrix.shape[1]):
eachrowBest+=(matrix[i][j]-ideal_best[j])**2
eachRowWorst+= (matrix[i][j] - ideal_worst[j])**2
euclidean_best[i]=np.sqrt(eachrowBest)
euclidean_worst[i]=np.sqrt(eachRowWorst)
return performance_score(matrix,euclidean_best,euclidean_worst)
def performance_score(matrix,euclidean_best,euclidean_worst):
performance=np.zeros(matrix.shape[0])
for i in range( matrix.shape[0]):
performance[i]=euclidean_worst[i]/(euclidean_best[i]+euclidean_worst[i])
return performance
def topsis():
try:
filename=sys.argv[1]
except:
print('please provide 4 arguements as inputData.csv weights impacts outputFile.csv')
sys.exit(1)
try:
weight_input = sys.argv[2]
except:
print('please provide 3 more arguement')
sys.exit(1)
try:
impacts = sys.argv[3]
except:
print('please provide 2 more arguement')
sys.exit(1)
try:
impacts = sys.argv[3]
except:
print('please provide 1 more arguement')
sys.exit(1)
try:
df = pd.read_csv(filename)
except:
print('Could not read the file given by you')
number_columns=len(df.columns)
if number_columns<3:
raise Exception("Less Col")
if len(sys.argv)!=5:
raise Exception("WrongInput")
if df.isnull().sum().sum()>0:
raise Exception("Blank")
outputFileName = sys.argv[4]
matrix = df.values
original_matrix=matrix
try:
impacts_1=list(e for e in impacts.split(','))
impact_final =[]
for i in impacts_1 :
if(i=='+'):
impact_final.append(1)
elif(i=='-'):
impact_final.append(0)
else:
raise Exception('Impacts must be + or -')
except:
print('could not correctly parse correctly impacts arguement ')
try:
weights=list(float(w) for w in weight_input.split(','))
except:
print(" could not correctly parse weigths argument")
matrix=create_matrix(matrix)
normailze_matrix=normalize(matrix,weights)
performance=cases(normailze_matrix,np.asarray(impact_final))
l = list(performance)
rank = [sorted(l, reverse=True).index(x) for x in l]
df['Score'] = performance
df['Rank'] = rank
df['Rank'] = df['Rank'] + 1
df.to_csv(outputFileName)
topsis() | 101903700-Topsis-code | /101903700-Topsis-code-0.0.1.tar.gz/101903700-Topsis-code-0.0.1/code_topsis/101903700.py | 101903700.py |
MOKSHIT GOGIA
ASSIGNMENT 4
101903751
| 101903751-topsis | /101903751-topsis-.tar.gz/101903751-topsis-1.0.0/README.md | README.md |
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="101903751-topsis",
version="1.0.0",
description="Assignment-4",
long_description=README,
long_description_content_type="text/markdown",
author="MOKSHIT GOGIA",
author_email="gogiamokshit16@gmail.com",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=["project"],
include_package_data=True,
install_requires=[],
entry_points={
"console_scripts": [
"square=square.__main__:main",
]
},
) | 101903751-topsis | /101903751-topsis-.tar.gz/101903751-topsis-1.0.0/setup.py | setup.py |
import sys
import pandas as pd
import math
import copy
n = len(sys.argv)
if n == 5:
if sys.argv[1] == "file name":
try:
top = pd.read_csv(sys.argv[1])
finl = copy.deepcopy(top)
except:
print('Error! File not Found')
sys.exit()
if top.shape[1] >= 3:
for col in top.columns[1:]:
try:
pd.to_numeric(top[col])
except:
print("Error! Not all the columns after 2nd are numeric")
we = list(sys.argv[2].split(','))
I = list(sys.argv[3].split(','))
w = []
for i in we:
w.append(float(i))
if top.shape[1]-1 == len(w) and top.shape[1]-1 == len(I):
list1 = []
for col in top.columns[1:]:
num = 0
for row in top[col]:
num = num + row * row
list1.append(num)
k = 1
for i in range(top.shape[0]):
for j in range(1, top.shape[1]):
top.iloc[i, j] = top.iloc[i, j] / list1[j - 1]
for i in range(top.shape[0]):
for j in range(1, top.shape[1]):
top.iloc[i, j] = top.iloc[i, j] * w[j - 1]
best = []
worst = []
k = 0
for col in top.columns[1:]:
if I[k] == '-':
best.append(top[col].min())
worst.append(top[col].max())
else:
best.append(top[col].max())
worst.append(top[col].min())
k = k + 1
E_best = []
E_worst = []
for i in range(top.shape[0]):
sq_best = 0
sq_worst = 0
diff = 0
diff_best = 0
diff_worst = 0
for j in range(1, top.shape[1]):
diff = top.iloc[i, j] - best[j-1]
diff_best = diff * diff
diff = top.iloc[i, j] - worst[j - 1]
diff_worst = diff * diff
sq_best = sq_best + diff_best
sq_worst = sq_worst + diff_worst
E_best.append(math.sqrt(sq_best))
E_worst.append(math.sqrt(sq_worst))
P_score = []
for i in range(top.shape[0]):
P_score.append(E_worst[i] / (E_worst[i] + E_best[i]))
finl['Topsis Score'] = P_score
finl['Rank'] = finl['Topsis Score'].rank(ascending=False)
finl.to_csv(sys.argv[4])
print("Output file successfully created.")
else:
print("Error! Impacts and weights must be separated by ‘,’ (comma).")
sys.exit()
else:
print("Error! Input file must have more than 3 columns.")
sys.exit()
else:
print("Error! File not found")
sys.exit()
else:
print("Error! Arguments passed are either more or less than 4.")
| 101903751-topsis | /101903751-topsis-.tar.gz/101903751-topsis-1.0.0/project/__main__.py | __main__.py |
__version__="1.0.0"
| 101903751-topsis | /101903751-topsis-.tar.gz/101903751-topsis-1.0.0/project/__init__.py | __init__.py |
from setuptools import setup, find_packages
import codecs
import os
VERSION = '0.0.1'
DESCRIPTION = 'Calculating topsis Score'
# LONG_DESCRIPTION = 'A package that allows to build simple streams of video, audio and camera data.'/
# Setting up
setup(
name="101903762",
version=VERSION,
author="Divyanshu",
author_email="<djindal1_be19@thapar.edu>",
description=DESCRIPTION,
# long_description_content_type="text/markdown",
# long_description=long_description,
packages=find_packages(),
install_requires=['pandas', 'numpy'],
keywords=['python', 'video', 'stream', 'video stream', 'camera stream', 'sockets'],
classifiers=[
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: Unix",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
]
) | 101903762 | /101903762-0.0.1.tar.gz/101903762-0.0.1/setup.py | setup.py |
from distutils.core import setup
setup(
name = '101917149-topsis', # How you named your package folder (MyLib)
packages = ['101917149-topsis'], # Chose the same as "name"
version = '0.3', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'topsis', # Give a short description about your library
author = 'Daksh Arora', # Type in your name
author_email = 'Daksharora79@gmail.com', # Type in your E-Mail
url = 'https://github.com/DAKSH1-HUB/101917149-TOPSIS.git', # Provide either the link to your github or to your website
download_url = 'https://github.com/DAKSH1-HUB/101917149-TOPSIS/archive/refs/tags/0.3.tar.gz', # I explain this later on
keywords = ['101917149', 'topsis', 'Topsis'], # Keywords that define your package best
install_requires=[ # I get to this in a second
'numpy',
'pandas',
],
classifiers=[
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
'Intended Audience :: Developers', # Define that your audience are developers
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License', # Again, pick a license
'Programming Language :: Python :: 3', #Specify which pyhton versions that you want to support
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
) | 101917149-topsis | /101917149-topsis-0.3.tar.gz/101917149-topsis-0.3/setup.py | setup.py |
## README.md
It's a example pack
| 101hello-0.0.1-redish101 | /101hello-0.0.1-redish101-0.0.1.tar.gz/101hello-0.0.1-redish101-0.0.1/README.md | README.md |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="101hello-0.0.1-redish101",
version="0.0.1",
author="Redish101",
author_email="jiayunluo@yeah.net",
description="A small example package",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
package_dir={"": "src"},
packages=setuptools.find_packages(where="src"),
python_requires=">=3.6",
)
| 101hello-0.0.1-redish101 | /101hello-0.0.1-redish101-0.0.1.tar.gz/101hello-0.0.1-redish101-0.0.1/setup.py | setup.py |
def 101helloworld():
print("hello,world!")
| 101hello-0.0.1-redish101 | /101hello-0.0.1-redish101-0.0.1.tar.gz/101hello-0.0.1-redish101-0.0.1/src/101helloworld/101helloworld.py | 101helloworld.py |
"""这是一个nester模块,定义了一个名为print_lol的函数,这个函数的作用
是用于打印列表,列表中可能包含嵌套列表"""
def print_lol(the_list):
"""这个函数取一个位置参数名为the_list,这可以是任何一个列表,所指定的列表中的每个数据都会输出到屏幕上,各数据占据一行"""
for each_item in the_list:
if isinstance(each_item,list):
print_lol(each_item)
else:
print(each_item)
| 1020-nester | /1020-nester-1.00.zip/1020-nester-1.00/1020-nester.py | 1020-nester.py |
from distutils.core import setup
setup(
name ="1020-nester",
version ="1.00",
py_modules=["1020-nester"],
author ="treeee",
author_email="429669469@qq.com",
url="lll.com",
description="a simple printer of nested lists",
)
| 1020-nester | /1020-nester-1.00.zip/1020-nester-1.00/setup.py | setup.py |
## 102003017
### It finds topsis Score and based on that calculates the rank.
### Installation
## pip install 102003017
## License
### © 2023 Srishti Sharma
### This repository is licensed under the MIT license. See LICENSE for details. | 102003017 | /102003017-1.0.0.tar.gz/102003017-1.0.0/README.md | README.md |
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="102003017",
version="1.0.0",
description="It finds topsis Score and based on that calculates the rank",
long_description=README,
long_description_content_type="text/markdown",
author="Srishti Sharma",
author_email="ssharma5_be20@thapar.edu",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=["102003017"],
include_package_data=True,
install_requires=["pandas", "numpy", "math", "logging", "sys"],
entry_points={
"console_scripts": [
"topsis=topsis.__main__:main",
]
},
) | 102003017 | /102003017-1.0.0.tar.gz/102003017-1.0.0/setup.py | setup.py |
# 102003037 TOPSIS PACKAGE HIMANGI SHARMA
Roll Number : 102003037 <br>
Subgroup : 3COE18 <br>
The program takes csv file containing our data to be ranked, weights and impacts in the form of "+" or "-", seperated by commas as inputs and then outputs a resultant csv file with two additional columns of performance score and Ranks.
# What is TOPSIS
TOPSIS, Technique of Order Preference Similarity to the Ideal Solution, is a multi-criteria decision analysis method (MCDA). <br>
It chooses the alternative of shortest the Euclidean distance from the ideal solution and greatest distance from the negative ideal solution. <br>
## Installation
### How to install the TOPSIS package <br>
using pip install:-<br>
``` pip install 102003037-topsis-Himangi ```
## For Calculating the TOPSIS Score
Open terminal and type <br>
``` 102003037 102003037-data.csv "1,1,1,1" "+,+,-,+" 102003037-output.csv ```
The output will then be saved in a newly created CSV file whose name will be provided in the command line by the user.
## Input File [102003037-data.csv]:
Topsis mathematical operations to be performed on the input file which contains a dataset having different fields.
## Weights ["1,1,1,1"]
The weights to assigned to the different parameters in the dataset should be passed in the argument, seperated by commas.
## Impacts ["+,+,-,+"]:
The impacts are passed to consider which parameters have a positive impact on the decision and which one have the negative impact. Only '+' and '-' values should be passed and should be seperated with ',' only.
## Output File [102003037-output.csv]:
This argument is used to pass the path of the result file where we want the rank and performance score to be stored.
| 102003037-topsis | /102003037-topsis-0.0.1.tar.gz/102003037-topsis-0.0.1/README.md | README.md |
from setuptools import setup, find_packages
import codecs
import os
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as fh:
long_description = "\n" + fh.read()
VERSION = '0.0.1'
DESCRIPTION = 'Topsis'
LONG_DESCRIPTION = 'A package for the implementation of TOPSIS used for MCDM'
# Setting up
setup(
name="102003037-topsis",
version=VERSION,
author="Himangi Sharma",
author_email="hsharma1_be20@thapar.edu",
description=DESCRIPTION,
long_description_content_type="text/markdown",
long_description=long_description,
packages=find_packages(),
install_requires=['numpy', 'pandas'],
keywords=['python','topsis'],
classifiers=[
"Development Status :: 1 - Planning",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3",
"Operating System :: Microsoft :: Windows",
]
)
| 102003037-topsis | /102003037-topsis-0.0.1.tar.gz/102003037-topsis-0.0.1/setup.py | setup.py |
import setuptools
from setuptools import setup
setup(
name = '102003050_topsis',
packages = ['102003050_topsis'],
version = '0.1',
license='MIT',
description = 'Calculate Topsis score and save it in a csv file',
author = 'Inaayat Goyal',
author_email = 'igoyal1_be20@thapar.edu',
url = 'https://github.com/Inaayat12/Topsis-102003050',
download_url = '',
keywords = ['TOPSISSCORE', 'RANK', 'DATAFRAME'],
install_requires=[
'numpy',
'pandas',
'DateTime',
'isqrt'
],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Topic :: Software Development :: Build Tools',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
],
)
| 102003050-topsis | /102003050_topsis-0.1.tar.gz/102003050_topsis-0.1/setup.py | setup.py |
import sys
import os
import pandas as pd
from datetime import datetime
from math import sqrt
import numpy as np
def sorter(x):
return int(x[1])
class Error(Exception):
pass
class MoreArgumentsError(Error):
pass
class NoArgumentsError(Error):
pass
class InvalidDataError(Error):
pass
class NumericError(Error):
pass
class ImpactsError(Error):
pass
class WeightsError(Error):
pass
class ImpactsTypeError(Error):
pass
class CommaError(Error):
pass
def TOPSIS():
"""This function returns a file by the name specified by the user in the command line arguments which contains the TOPSIS score as well as
rank for the different records being compared.
Usage:
1) Create a script by importing the package and just calling the TOPSIS function.
import importlib
topsis=importlib.import_module("Topsis-Inaayat-102003050")
topsis.TOPSIS()
2) Run the script from terminal with command line arguments:
C:/Users/admin> python myscript.py <Data_File_csv> <Weights(Comma_seperated)> <Impacts(Comma_seperated)> <Result_file_csv>
"""
args=sys.argv
try:
if len(args)<5:
raise(NoArgumentsError)
elif len(args)>5:
raise(MoreArgumentsError)
df=pd.read_csv(args[1])
if len(list(df.columns))<3:
raise(InvalidDataError)
d=pd.read_csv(args[1])
for i in df.columns[1:]:
if not(np.issubdtype(df[i].dtype, np.number)):
raise(NumericError)
sums=[np.sum(df.iloc[:,i].values**2) for i in range(1,len(df.columns))]
sums=[i**0.5 for i in sums]
sums=np.array(sums)
if(args[2].count(",")!=len(df.columns)-2 or args[3].count(",")!=len(df.columns)-2):
raise(CommaError)
weights=[ int(i) for i in args[2].split(",")]
impacts=args[3].split(",")
for i in impacts:
if( i!="+" and i!="-"):
print((i))
raise(ImpactsTypeError)
if(len(impacts)!=len(df.columns)-1):
raise(ImpactsError)
if(len(weights)!=len(df.columns)-1):
raise(WeightsError)
for i in range(len(df)):
df.iloc[i,1:]=(df.iloc[i,1:]/sums)*weights
ibest=[]
iworst=[]
#print(df)
for i in range(1,len(df.columns)):
if impacts[i-1]=="+":
ibest.append(max(df[df.columns[i]].values))
iworst.append(min(df[df.columns[i]].values))
elif impacts[i-1]=="-":
iworst.append(max(df[df.columns[i]].values))
ibest.append(min(df[df.columns[i]].values))
#print(ibest,iworst)
ibest=np.array(ibest)
iworst=np.array(iworst)
disbest=[sqrt(np.sum(np.square(ibest-df.iloc[i,1:].values))) for i in range(len(df))]
disworst=[sqrt(np.sum(np.square(iworst-df.iloc[i,1:].values))) for i in range(len(df))]
topsis=[disworst[i]/(disworst[i]+disbest[i]) for i in range(len(disbest))]
d["TOPSIS"]=topsis
d["Rank"]=d["TOPSIS"].rank(method="max",ascending=False)
d.to_csv(args[4],index=False)
except FileNotFoundError:
print("[",datetime.now(),"]","File Not Found: Cannot find the file",args[1],"at specified path")
except MoreArgumentsError:
print("[",datetime.now(),"]","Too Many Arguments Supplied for Runtime")
except NoArgumentsError:
print("[",datetime.now(),"]","Insufficient Arguments Supplied for Runtime")
except InvalidDataError:
print("[",datetime.now(),"]","File",args[1],"cannot be processed due to invalid structure(More Columns Required)")
except NumericError:
print("[",datetime.now(),"]","File",args[1],"cannot be processed due to invalid structure( 2nd to last columns must be numeric)")
except CommaError:
print("[",datetime.now(),"]","File",args[1],"cannot be processed due to invalid imput(Impacts and Weights must be seperated by comma)")
except ImpactsTypeError:
print("[",datetime.now(),"]","File",args[1],"cannot be processed due to invalid imput(Impacts must be either + or -)")
except ImpactsError:
print("[",datetime.now(),"]","File",args[1],"cannot be processed due to invalid imput(Impacts are not equal to features)")
except WeightsError:
print("[",datetime.now(),"]","File",args[1],"cannot be processed due to invalid imput(Weights are not equal to features)")
| 102003050-topsis | /102003050_topsis-0.1.tar.gz/102003050_topsis-0.1/102003050_topsis/topsis.py | topsis.py |
from .topsis import TOPSIS | 102003050-topsis | /102003050_topsis-0.1.tar.gz/102003050_topsis-0.1/102003050_topsis/__init__.py | __init__.py |
## 102003053
### It calculates topsis for a given data in csv file.
### Installation
## pip install 102003053
## License
### © 2023 Amit Kumar
### This repository is licensed under the MIT license. See LICENSE for details. | 102003053 | /102003053-1.1.0.tar.gz/102003053-1.1.0/README.md | README.md |
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="102003053",
version="1.1.0",
description="It finds topsis for the given data in csv file",
long_description=README,
long_description_content_type="text/markdown",
author="Amit Kumar",
author_email="akumar9_be20@thapar.edu",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=["102003053"],
include_package_data=True,
install_requires=["pandas", "numpy"],
entry_points={
"console_scripts": [
"topsis=topsis.__main__:main",
]
},
) | 102003053 | /102003053-1.1.0.tar.gz/102003053-1.1.0/setup.py | setup.py |
from distutils.core import setup
with open("README.md", "r") as fh:
long_description = fh.read()
setup(
name = '102003105', # How you named your package folder (MyLib)
packages = ['102003105'], # Chose the same as "name"
version = '1.0.5', # Start with a small number and increase it with every change you make
license='MIT', # Chose a license from here: https://help.github.com/articles/licensing-a-repository
description = 'A Python package to find TOPSIS for Multi-Criteria Decision Analysis Method', # Give a short description about your library
long_description=long_description,
long_description_content_type='text/markdown',
author = 'Aditya Kuthiala', # Type in your name
author_email = 'adityakuthiala1806@gmail.com', # Type in your E-Mail
url = 'https://github.com/AdiK1806/Topsis-Aditya-102003105', # Provide either the link to your github or to your website
keywords=['topsis', 'TIET' ,'Thapar'],
include_package_data=True,
install_requires=['pandas', 'tabulate'],
classifiers=[
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Operating System :: Microsoft :: Windows :: Windows 10',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3'
],
) | 102003105 | /102003105-1.0.5.tar.gz/102003105-1.0.5/setup.py | setup.py |
def add_numbers(a,b):
return a+b
def mul_numbers(a,b):
return a*b
def div_numbers(a,b):
return a/b
def sub_numbers(a,b):
return a-b
| 102003171-Calc | /102003171_Calc-0.2-py3-none-any.whl/mybasiccalculator/__init__.py | __init__.py |
import pandas as pd
import sys
import math
# read_file.to_csv("102003712-data.csv",
# index = None,
# header=True)
def main():
try:
read_file = pd.read_csv(sys.argv[1])
df = pd.DataFrame(read_file)
df1 = df.drop(df.columns[0], axis=1)
w = sys.argv[2]
weight = w.split(",")
weight = [eval(i) for i in weight]
i = sys.argv[3]
impact1 = i.split(",")
impact = []
for i in impact1:
if i == '+':
impact.append(1)
elif (i == '-'):
impact.append(0)
# print(impact)
rows = df1.shape[0]
cols = df1.shape[1]
ss = []
for j in range(0, cols):
sum = 0
for i in range(0, rows):
sum = sum+(df1.iloc[i, j]*df1.iloc[i, j])
sum = math.sqrt(sum)
ss.append(sum)
# print(ss)
for j in range(0, cols):
for i in range(0, rows):
df1.iloc[i, j] = (df1.iloc[i, j]/ss[j])*weight[j]
best = []
worst = []
for j in range(0, cols):
max = -1
min = 10000
for i in range(0, rows):
if (df1.iloc[i, j] > max):
max = df1.iloc[i, j]
if (df1.iloc[i, j] < min):
min2 = df1.iloc[i, j]
if (impact[j] == 1):
best.append(max)
worst.append(min)
elif (impact[j] == 0):
best.append(min)
worst.append(max)
ed_b = []
ed_w = []
for i in range(0, rows):
sum_b = 0
sum_w = 0
for j in range(0, cols):
sum_b = sum_b+((df1.iloc[i, j]-best[j])
* (df1.iloc[i, j]-best[j]))
sum_w = sum_w+((df1.iloc[i, j]-worst[j])
* (df1.iloc[i, j]-worst[j]))
ed_b.append(math.sqrt(sum_b))
ed_w.append(math.sqrt(sum_w))
p = []
for i in range(0, rows):
p.append(ed_w[i]/(ed_b[i]+ed_w[i]))
df["score"] = p
df["Rank"] = df["score"].rank()
df.to_csv(sys.argv[4], index=False)
except FileNotFoundError:
print('file not found')
except:
if (len(sys.argv) != 5):
print('ERROR: Please provide four arguments')
elif (len(weight) != len(impact) or len(weight) != cols or len(impact) != cols):
print('ERROR: incorrect arguments')
else:
print('ERROR')
if __name__ == '__main__':
main()
| 102003712 | /102003712-0.0.6-py3-none-any.whl/topsisLibrary/topsis.py | topsis.py |
import pandas as pd
import sys
import math
# read_file.to_csv("102003712-data.csv",
# index = None,
# header=True)
def main():
try:
read_file = pd.read_csv(sys.argv[1])
df = pd.DataFrame(read_file)
df1 = df.drop(df.columns[0], axis=1)
w = sys.argv[2]
weight = w.split(",")
weight = [eval(i) for i in weight]
i = sys.argv[3]
impact1 = i.split(",")
impact = []
for i in impact1:
if i == '+':
impact.append(1)
elif (i == '-'):
impact.append(0)
# print(impact)
rows = df1.shape[0]
cols = df1.shape[1]
ss = []
for j in range(0, cols):
sum = 0
for i in range(0, rows):
sum = sum+(df1.iloc[i, j]*df1.iloc[i, j])
sum = math.sqrt(sum)
ss.append(sum)
# print(ss)
for j in range(0, cols):
for i in range(0, rows):
df1.iloc[i, j] = (df1.iloc[i, j]/ss[j])*weight[j]
best = []
worst = []
for j in range(0, cols):
max = -1
min = 10000
for i in range(0, rows):
if (df1.iloc[i, j] > max):
max = df1.iloc[i, j]
if (df1.iloc[i, j] < min):
min2 = df1.iloc[i, j]
if (impact[j] == 1):
best.append(max)
worst.append(min)
elif (impact[j] == 0):
best.append(min)
worst.append(max)
ed_b = []
ed_w = []
for i in range(0, rows):
sum_b = 0
sum_w = 0
for j in range(0, cols):
sum_b = sum_b+((df1.iloc[i, j]-best[j])
* (df1.iloc[i, j]-best[j]))
sum_w = sum_w+((df1.iloc[i, j]-worst[j])
* (df1.iloc[i, j]-worst[j]))
ed_b.append(math.sqrt(sum_b))
ed_w.append(math.sqrt(sum_w))
p = []
for i in range(0, rows):
p.append(ed_w[i]/(ed_b[i]+ed_w[i]))
df["score"] = p
df["Rank"] = df["score"].rank()
df.to_csv(sys.argv[4], index=False)
except FileNotFoundError:
print('file not found')
except:
if (len(sys.argv) != 5):
print('ERROR: Please provide four arguments')
elif (len(weight) != len(impact) or len(weight) != cols or len(impact) != cols):
print('ERROR: incorrect arguments')
else:
print('ERROR')
if __name__ == '__main__':
main()
| 102003759 | /102003759-0.0.1-py3-none-any.whl/Topsis/topsis.py | topsis.py |
import pandas as pd
import sys
import math
# author : Sahil Chhabra
# email : sahil.chh718@gmail.com
def main():
try:
read_file = pd.read_csv(sys.argv[1])
print(sys.argv)
df = pd.DataFrame(read_file)
df1 = df.drop(df.columns[0], axis=1)
w = sys.argv[2]
weight = w.split(",")
weight = [eval(i) for i in weight]
i = sys.argv[3]
impact1 = i.split(",")
impact = []
for i in impact1:
if i == '+':
impact.append(1)
elif (i == '-'):
impact.append(0)
# print(impact)
rows = df1.shape[0]
cols = df1.shape[1]
ss = []
for j in range(0, cols):
sum = 0
for i in range(0, rows):
sum = sum+(df1.iloc[i, j]*df1.iloc[i, j])
sum = math.sqrt(sum)
ss.append(sum)
# print(ss)
for j in range(0, cols):
for i in range(0, rows):
df1.iloc[i, j] = (df1.iloc[i, j]/ss[j])*weight[j]
best = []
worst = []
for j in range(0, cols):
max = -1
min = 10000
for i in range(0, rows):
if (df1.iloc[i, j] > max):
max = df1.iloc[i, j]
if (df1.iloc[i, j] < min):
min2 = df1.iloc[i, j]
if (impact[j] == 1):
best.append(max)
worst.append(min)
elif (impact[j] == 0):
best.append(min)
worst.append(max)
ed_b = []
ed_w = []
for i in range(0, rows):
sum_b = 0
sum_w = 0
for j in range(0, cols):
sum_b = sum_b+((df1.iloc[i, j]-best[j])
* (df1.iloc[i, j]-best[j]))
sum_w = sum_w+((df1.iloc[i, j]-worst[j])
* (df1.iloc[i, j]-worst[j]))
ed_b.append(math.sqrt(sum_b))
ed_w.append(math.sqrt(sum_w))
p = []
for i in range(0, rows):
p.append(ed_w[i]/(ed_b[i]+ed_w[i]))
df["score"] = p
df["Rank"] = df["score"].rank()
df.to_csv(sys.argv[4], index=False)
except FileNotFoundError:
print('file not found')
except:
if (len(sys.argv) != 5):
print('ERROR: Please provide four arguments')
elif (len(weight) != len(impact) or len(weight) != cols or len(impact) != cols):
print('ERROR: incorrect arguments')
else:
print('ERROR')
if __name__ == '__main__':
main() | 102003766-topsis | /102003766_topsis-0.0.1-py3-none-any.whl/topsis.py | topsis.py |
# 102017059_Aakanksha_Topsis
This package is implementation of multi-criteria decision analysis using topsis. This package will accept three arguments during file execution:
dataset.csv //file which contains the models and parameters
string of weights separated by commas(,)
string of requirements (+/-) separated by commas(,) // important install pandas,sys,operator and math libraries before installing this // You can install this package using following command pip install 102017059_Aakanksha_Topsis
| 102017059-Aakanksha-Topsis | /102017059_Aakanksha_Topsis-0.0.0.tar.gz/102017059_Aakanksha_Topsis-0.0.0/README.md | README.md |
import pathlib
from setuptools import setup
# The directory containing this file
HERE = pathlib.Path(__file__).parent
# The text of the README file
README = (HERE / "README.md").read_text()
# This call to setup() does all the work
setup(
name="102017059_Aakanksha_Topsis",
version="0.0.0",
description="Topsis Implementation",
long_description=README,
long_description_content_type="text/markdown",
url="https://github.com/aakanksha-17/102017059_Aakanksha_Topsis.git",
author="Aakanksha Pandey",
author_email="apandey1_be20@thapar.edu",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
],
packages=["topsis"],
include_package_data=True,
install_requires=[],
entry_points={
"console_scripts": [
"topsis=topsis.__main__:main",
]
},
) | 102017059-Aakanksha-Topsis | /102017059_Aakanksha_Topsis-0.0.0.tar.gz/102017059_Aakanksha_Topsis-0.0.0/setup.py | setup.py |
import numpy as np
import pandas as pd
import math as math
import operator
import sys
def main():
if(len(sys.argv)!=5):
print("Wrong arguments")
exit(0)
df=pd.read_csv(sys.argv[1])
wt=[float(w) for w in sys.argv[2].split(',')]
bt=[i for i in sys.argv[3].split(',')]
if(len(wt)!=df.shape[1]-1):
print("Incorrect weights")
exit(0)
if(len(bt)!=df.shape[1]-1):
print("Incorrect impacts")
exit(0)
# new data set will copy values one by one
df1=df.iloc[:,1:].values
try:
wt=[w/sum(wt) for w in wt]
except:
print("exception 1 raised")
for i in range(df1.shape[1]):
dmn=math.sqrt(sum(df1[:,i]**2))
for j in range(df1.shape[0]):
try:
df1[j][i]= (df1[j][i])/dmn
except:
print("exception 2 raised")
for i in range(df1.shape[1]):
df1[:,i]=df1[:,i]*wt[i]
ibestv=[]
iworstv=[]
for i in range(len(bt)):
if(bt[i]=='+'):
ibestv.append(max(df1[:,i]))
iworstv.append(min(df1[:,i]))
else:
ibestv.append(min(df1[:,i]))
iworstv.append(max(df1[:,i]))
good=[]
bad=[]
for i in range(df1.shape[0]):
sum1=0
sum2=0
for j in range(df1.shape[1]):
sum1=sum1+ (df1[i][j]-ibestv[j])**2
sum1=math.sqrt(sum1)
sum2=sum2+ (df1[i][j]-iworstv[j])**2
sum2=math.sqrt(sum2)
good.append(sum1)
bad.append(sum2)
performance=[]
for i in range(len(good)):
try:
performance.append(bad[i]/(bad[i]+good[i]))
except:
print("exception 3 raised")
mat=[]
for i in range(len(performance)):
mat.append([i+1, df.iloc[i,0], performance[i],0])
mat.sort(key=operator.itemgetter(2))
for i in range(len(mat)):
mat[i][3]=len(mat)-i
mat.sort(key=operator.itemgetter(0))
df['Performance']=performance
rank=[]
for i in range(len(mat)):
rank.append(mat[i][3])
df['Rank']=rank
of=sys.argv[4]
df.to_csv(of)
print("DONE")
if __name__=="__main__":
main() | 102017059-Aakanksha-Topsis | /102017059_Aakanksha_Topsis-0.0.0.tar.gz/102017059_Aakanksha_Topsis-0.0.0/topsis/__main__.py | __main__.py |
version= '0.0.0' | 102017059-Aakanksha-Topsis | /102017059_Aakanksha_Topsis-0.0.0.tar.gz/102017059_Aakanksha_Topsis-0.0.0/topsis/__init__.py | __init__.py |
TOPSIS Package
TOPSIS stands for Technique for Oder Preference by Similarity to Ideal Solution. It is a method of compensatory aggregation that compares a set of alternatives by identifying weights for each criterion, normalising scores for each criterion and calculating the geometric distance between each alternative and the ideal alternative, which is the best score in each criterion. An assumption of TOPSIS is that the criteria are monotonically increasing or decreasing. In this Python package Vector Normalization has been implemented.
This package has been created based on Project 1 of course UCS633. Tarandeep Singh 102017067
In Command Prompt
>topsis data.csv "1,1,1,1" "+,+,-,+"
| 102017067-topsis | /102017067-topsis-1.0.0.tar.gz/102017067-topsis-1.0.0/README.md | README.md |
from setuptools import setup
def readme():
with open('README.md') as f:
README = f.read()
return README
setup(
name="102017067-topsis",
version="1.0.0",
description="A Python package to get optimal solutiion.",
long_description=readme(),
long_description_content_type="text/markdown",
author="Tarandeep Singh",
author_email="tarandeep293@gmail.com",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
],
packages=["topsis"],
include_package_data=True,
install_requires=["sys","os","pandas","math","numpy"],
entry_points={
"console_scripts": [
"102017067-topsis=topsis.102017067_topsis:main",
]
},
)
| 102017067-topsis | /102017067-topsis-1.0.0.tar.gz/102017067-topsis-1.0.0/setup.py | setup.py |
# -*- coding: utf-8 -*-
import sys
import os
import pandas as pd
import math
import numpy as np
class Topsis:
def __init__(self,filename):
if os.path.isdir(filename):
head_tails = os.path.split(filename)
data = pd.read_csv(head_tails[1])
if os.path.isfile(filename):
data = pd.read_csv(filename)
self.d = data.iloc[1:,1:].values
self.features = len(self.d[0])
self.samples = len(self.d)
def fun(self,a):
return a[1]
def fun2(self,a):
return a[0]
def evaluate(self,w = None,im = None):
d = self.d
features = self.features
samples = self.samples
if w==None:
w=[1]*features
if im==None:
im=["+"]*features
ideal_best=[]
ideal_worst=[]
for i in range(0,features):
k = math.sqrt(sum(d[:,i]*d[:,i]))
maxx = 0
minn = 1
for j in range(0,samples):
d[j,i] = (d[j,i]/k)*w[i]
if d[j,i]>maxx:
maxx = d[j,i]
if d[j,i]<minn:
minn = d[j,i]
if im[i] == "+":
ideal_best.append(maxx)
ideal_worst.append(minn)
else:
ideal_best.append(minn)
ideal_worst.append(maxx)
plt = []
for i in range(0,samples):
a = math.sqrt(sum((d[i]-ideal_worst)*(d[i]-ideal_worst)))
b = math.sqrt(sum((d[i]-ideal_best)*(d[i]-ideal_best)))
lst = []
lst.append(i)
lst.append(a/(a+b))
plt.append(lst)
plt.sort(key=self.fun)
rank = 1
for i in range(samples-1,-1,-1):
plt[i].append(rank)
rank+=1
plt.sort(key=self.fun2)
return plt
def findTopsis(filename,w,i):
observations = Topsis(filename)
result = observations.evaluate(w,i)
print(result)
def main():
lst = sys.argv
length = len(lst)
if length > 4 or length< 4:
print("wrong Parameters")
else:
w = list(map(int,lst[2].split(',')))
i = lst[3].split(',')
observations = Topsis(lst[1])
result = observations.evaluate(w,i)
# print (res)
# print(type(res))
# df = pd.DataFrame(res)
# df.to_csv('EmployeeData.csv')
# res.to_csv("output.csv")
dataframe = pd.DataFrame(result)
dataframe.to_csv("output.csv")
if __name__ == '__main__':
main()
| 102017067-topsis | /102017067-topsis-1.0.0.tar.gz/102017067-topsis-1.0.0/topsis/102017067.py | 102017067.py |
TOPSIS Package
TOPSIS stands for Technique for Oder Preference by Similarity to Ideal Solution. It is a method of compensatory aggregation that compares a set of alternatives by identifying weights for each criterion, normalising scores for each criterion and calculating the geometric distance between each alternative and the ideal alternative, which is the best score in each criterion. An assumption of TOPSIS is that the criteria are monotonically increasing or decreasing. In this Python package Vector Normalization has been implemented.
This package has been created based on Assignment 1 of course UCS654. Prince Sharma 102017119
In Command Prompt
>topsis data.csv "1,1,1,1" "+,+,-,+"
| 102017119-topsis | /102017119-topsis-1.0.0.tar.gz/102017119-topsis-1.0.0/README.md | README.md |
from setuptools import setup
def readme():
with open('README.md') as f:
README = f.read()
return README
setup(
name="102017119-topsis",
version="1.0.0",
description="A Python package to get optimal solutiion.",
long_description=readme(),
long_description_content_type="text/markdown",
author="Prince Sharma",
author_email="sharmajhonny15@gmail.com",
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
],
packages=["topsis"],
include_package_data=True,
install_requires=["sys","os","pandas","math","numpy"],
entry_points={
"console_scripts": [
"102017119-topsis=topsis.102017119_topsis:main",
]
},
)
| 102017119-topsis | /102017119-topsis-1.0.0.tar.gz/102017119-topsis-1.0.0/setup.py | setup.py |
# -*- coding: utf-8 -*-
import sys
import os
import pandas as pd
import math
import numpy as np
class Topsis:
def __init__(self,filename):
if os.path.isdir(filename):
head_tails = os.path.split(filename)
data = pd.read_csv(head_tails[1])
if os.path.isfile(filename):
data = pd.read_csv(filename)
self.d = data.iloc[1:,1:].values
self.features = len(self.d[0])
self.samples = len(self.d)
def fun(self,a):
return a[1]
def fun2(self,a):
return a[0]
def evaluate(self,w = None,im = None):
d = self.d
features = self.features
samples = self.samples
if w==None:
w=[1]*features
if im==None:
im=["+"]*features
ideal_best=[]
ideal_worst=[]
for i in range(0,features):
k = math.sqrt(sum(d[:,i]*d[:,i]))
maxx = 0
minn = 1
for j in range(0,samples):
d[j,i] = (d[j,i]/k)*w[i]
if d[j,i]>maxx:
maxx = d[j,i]
if d[j,i]<minn:
minn = d[j,i]
if im[i] == "+":
ideal_best.append(maxx)
ideal_worst.append(minn)
else:
ideal_best.append(minn)
ideal_worst.append(maxx)
plt = []
for i in range(0,samples):
a = math.sqrt(sum((d[i]-ideal_worst)*(d[i]-ideal_worst)))
b = math.sqrt(sum((d[i]-ideal_best)*(d[i]-ideal_best)))
lst = []
lst.append(i)
lst.append(a/(a+b))
plt.append(lst)
plt.sort(key=self.fun)
rank = 1
for i in range(samples-1,-1,-1):
plt[i].append(rank)
rank+=1
plt.sort(key=self.fun2)
return plt
def findTopsis(filename,w,i):
observations = Topsis(filename)
result = observations.evaluate(w,i)
print(result)
def main():
lst = sys.argv
length = len(lst)
if length > 4 or length< 4:
print("wrong Parameters")
else:
w = list(map(int,lst[2].split(',')))
i = lst[3].split(',')
observations = Topsis(lst[1])
result = observations.evaluate(w,i)
# print (res)
# print(type(res))
# df = pd.DataFrame(res)
# df.to_csv('EmployeeData.csv')
# res.to_csv("output.csv")
dataframe = pd.DataFrame(result)
dataframe.to_csv("output.csv")
if __name__ == '__main__':
main()
| 102017119-topsis | /102017119-topsis-1.0.0.tar.gz/102017119-topsis-1.0.0/topsis/102017119.py | 102017119.py |
import pandas as pd
import sys
import os
def main() :
if len(sys.argv) != 5 : #for the proper usage
print("ERROR : NUMBER OF PARAMETERS")
print("USAGE : python <filename>.py inputfile.csv '1,1,1,1' '+,+,-,+' result.csv ")
exit(1)
elif not os.path.isfile(sys.argv[1]): #for file not found
print(f"ERROR : {sys.argv[1]} Doesn't exist, Please check if you have entered the right file")
exit(1)
elif ".csv" != (os.path.splitext(sys.argv[1]))[1]: #for csv format
print(f"ERROR : Please enter {sys.argv[1]} in csv format")
exit(1)
else :
dataset = pd.read_csv(sys.argv[1])
ncol = len(dataset.columns.values)
if ncol < 3 :
print("ERROR : Minimum Number of Columns should be 3")
exit(1)
for i in range(1,ncol) :
pd.to_numeric(dataset.iloc[:,i],errors='coerce')
#if there are missing values
#dataset.iloc[:,i].fillna((dataset[:,i].values.mean()),inplace=True)
try :
weights = [int(i) for i in sys.argv[2].split(',')]
except :
print('ERROR : Weights array not input properly')
exit(1)
#checking impact array
for i in sys.argv[3].split(',') :
if i not in ['+','-'] :
print('Error : Impacts can only be + or -')
exit(1)
impact = sys.argv[3].split(',')
if ncol != len(weights) + 1 or ncol != len(impact) :
print("ERROR : The lenghts of either weights or impact doesn't match with the dataset length")
print('Length of dataset : ',ncol-1,'\n Length of weights :',len(weights),'\nLenght of imapcts :',len(impact))
exit(1)
if('.csv' != (os.path.splitext(sys.argv[4]))[1]) :
print('ERROR : output file should be in csv form')
exit(1)
topsis = Topsis()
topsis.topsis(dataset,weights,impact,ncol)
class Topsis :
def __Normalize(self,dataset,nCol,weight) :
for i in range(1,nCol) :
temp = 0
for j in range(len(dataset)) :
temp = temp + dataset.iloc[j,i] ** 2 #sum of squares
temp = temp ** 0.5
for j in range(len(dataset)) :
dataset.iat[j,i] = (dataset.iloc[j,i] / temp) * weight[i-1] #adjusting according to weights
#print(dataset)
return dataset
def __ideal_best_worst(self,dataset,ncol,impact) :
ideal_best_values = (dataset.max().values)[1:]
ideal_worst_values = (dataset.min().values)[1:]
#print(ncol,len(impact))
for i in range(1,ncol) :
if impact[i-1] == '-' :
ideal_best_values[i-1],ideal_worst_values[i-1] = ideal_worst_values[i-1],ideal_best_values[i-1]
return ideal_best_values, ideal_worst_values
def topsis(self,dataset,weights,impact,ncol) :
#ncol = len(dataset.axes[1])
dataset = self.__Normalize(dataset,ncol,weights)
p_sln , n_sln = self.__ideal_best_worst(dataset,ncol,impact)
score = []
pp = [] #positive distances
nn = [] #negative distances
for i in range(len(dataset)) :
temp_p,temp_n = 0,0
for j in range(1,ncol) :
temp_p += (p_sln[j-1] - dataset.iloc[i,j])**2
temp_n += (n_sln[j-1] - dataset.iloc[i,j])**2
temp_p,temp_n = temp_p**0.5,temp_n**0.5
score.append(temp_n/(temp_p+temp_n))
nn.append(temp_n)
pp.append(temp_p)
# dataset['positive distance'] = pp
# dataset['negative distance'] = nn
#print(score)
dataset['Topsis Score'] = score
dataset['Rank'] = (dataset['Topsis Score'].rank(method = 'max',ascending = False))
dataset = dataset.astype({"Rank" : int})
dataset.to_csv(sys.argv[4],index = False)
if __name__ == '__main__' :
main()
| 102053005-Aditya-Topsis | /102053005_Aditya_Topsis-0.11-py3-none-any.whl/102053005_Aditya_Topsis/102053005.py | 102053005.py |
import pandas as pd
result_file = input("Enter output file: ")
data_file = input("Enter csv data file: ")
data = pd.read_csv(data_file, header=None)
print(data)
#apply vector normalization
#multiply weights
| 102053010 | /102053010-0.0.1-py3-none-any.whl/src/topsis.py | topsis.py |
import pandas as pd
result_file = input("Enter output file: ")
data_file = input("Enter csv data file: ")
data = pd.read_csv(data_file, header=None)
print(data)
#apply vector normalization
#multiply weights
| 102053010 | /102053010-0.0.1-py3-none-any.whl/src/102053010.py | 102053010.py |
from setuptools import setup, find_packages
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Education',
'Operating System :: Microsoft :: Windows :: Windows 10',
#'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3'
]
setup(
name='102053024',
version='0.0.1',
description='Topsis Code',
long_description=open('readme.txt').read() + '\n\n' + open('changelog.txt').read(),
url='',
author='Khushi Bathla',
author_email='kbathla_be20@thapar.edu',
#license='MIT',
classifiers=classifiers,
keywords='topsis',
packages=find_packages(),
install_requires=['']
)
| 102053024 | /102053024-0.0.1.tar.gz/102053024-0.0.1/setup.py | setup.py |
import pandas as pd
import numpy as np
import sys
def topsis():
if len(sys.argv)!=5:
print("Wrong command line input")
exit()
try:
with open(sys.argv[1], 'r') as filee:
df=pd.read_csv(filee)
except FileNotFoundError:
print("File not found")
exit()
punctuation_dictionary = {'.':True,'@': True, '^': True, '!': True, ' ': True, '#': True, '%': True,'$': True, '&': True, ')': True, '(': True, '+': True, '*': True,'-': True, '=': True}
punctuation_dictionary2 = {'.':True,'@': True, '^': True, '!': True, ' ': True, '#': True, '%': True,'$': True, '&': True, ')': True, '(': True, '*': True, '=': True}
def char_check(new_list, punct_dict):
for item in new_list:
for char in item:
if char in punct_dict:
return False
def string_check(comma_check_list, punct_dict):
for string in comma_check_list:
new_list = string.split(",")
if char_check(new_list, punct_dict) == False:
print("Invalid input or Values not comma separated")
exit()
string_check(sys.argv[2], punctuation_dictionary)
string_check(sys.argv[3], punctuation_dictionary2)
nCol=len(df.columns)
weights1 = list(sys.argv[2].split(","))
impacts = list(sys.argv[3].split(","))
weights = [eval(i) for i in weights1]
if nCol<3:
print("No of columns are less than 3.")
exit()
if len(impacts) != (nCol-1):
print("No of values in impacts should be same as the number of columns.")
exit()
if len(weights) != (nCol-1):
print("No of values in weights should be same as the number of columns.")
exit()
for i in range(len(impacts)):
if(impacts[i]!="+" and impacts[i]!="-"):
print("Impacts should be either '+' or '-'.")
exit()
for index,row in df.iterrows():
try:
float(row['P1'])
float(row['P2'])
float(row['P3'])
float(row['P4'])
float(row['P5'])
except:
df.drop(index,inplace=True)
df["P1"] = pd.to_numeric(df["P1"], downcast="float")
df["P2"] = pd.to_numeric(df["P2"], downcast="float")
df["P3"] = pd.to_numeric(df["P3"], downcast="float")
df["P4"] = pd.to_numeric(df["P4"], downcast="float")
df["P5"] = pd.to_numeric(df["P5"], downcast="float")
df = df.copy(deep=True)
for i in range(1,nCol):
temp=0
for j in range(len(df)):
temp=temp+df.iloc[j,i]**2
temp=temp**0.5
for j in range(len(df)):
df.iat[j, i] = (df.iloc[j, i] / temp)*weights[i-1]
ideal_best=(df.max().values)[1:]
ideal_worst=(df.min().values)[1:]
for i in range(1,nCol):
if(impacts[i-1]=='-'):
ideal_best[i-1],ideal_worst[i-1]=ideal_worst[i-1],ideal_best[i-1]
score=[]
distance_positive=[]
distance_negative=[]
for i in range(len(df)):
temp_p,temp_n=0,0
for j in range(1,nCol):
temp_p=temp_p + (ideal_best[j-1]-df.iloc[i,j])**2
temp_n=temp_n + (ideal_worst[j-1]-df.iloc[i,j])**2
temp_p=temp_p**0.5
temp_n=temp_n**0.5
score.append(temp_n/(temp_p + temp_n))
distance_negative.append(temp_n)
distance_positive.append(temp_p)
df['distance negative']=distance_negative
df['distance positive']=distance_positive
df['Topsis Score']=score
df['Rank'] = (df['Topsis Score'].rank(method='max', ascending=False))
df = df.astype({"Rank": int})
print(df)
df.to_csv(sys.argv[4],index=False) | 102053042TOPSIS | /102053042TOPSIS-0.0.1-py3-none-any.whl/Topsis_102053042/Topsis_102053042.py | Topsis_102053042.py |
from Topsis_102053042 import topsis | 102053042TOPSIS | /102053042TOPSIS-0.0.1-py3-none-any.whl/Topsis_102053042/__init__.py | __init__.py |
# -*- coding: utf-8 -*-
from setuptools import setup
packages = \
['1082_msr_bhp']
package_data = \
{'': ['*']}
install_requires = \
['click>=8.0.3,<9.0.0']
setup_kwargs = {
'name': '1082-msr-bhp',
'version': '0.1.0',
'description': '',
'long_description': None,
'author': 'Lucas Selfslagh',
'author_email': 'lucas.selfslagh@gmail.com',
'maintainer': None,
'maintainer_email': None,
'url': None,
'packages': packages,
'package_data': package_data,
'install_requires': install_requires,
'python_requires': '>=3.10,<4.0',
}
setup(**setup_kwargs)
| 1082-msr-bhp | /1082-msr-bhp-0.1.0.tar.gz/1082-msr-bhp-0.1.0/setup.py | setup.py |
# src/hypermodern_python/console.py
import os
import click
from . import __version__
@click.command()
@click.version_option(version=__version__)
def main():
click.echo("Hello, world!")
click.echo(os.getcwd()) | 1082-msr-bhp | /1082-msr-bhp-0.1.0.tar.gz/1082-msr-bhp-0.1.0/1082_msr_bhp/console.py | console.py |
__version__ = '0.1.0'
| 1082-msr-bhp | /1082-msr-bhp-0.1.0.tar.gz/1082-msr-bhp-0.1.0/1082_msr_bhp/__init__.py | __init__.py |
# 10EngineeringProblems
Programs designed to Solve Engineering Problems
To run each program just import the module using
`import 10EngrProblems`
Then to run each block of code just call *HW* then the number of the problem you are working on.
As seen below this is how you would run HW1()
`HW1()`
| 10EngrProblems | /10EngrProblems-1.0.tar.gz/10EngrProblems-1.0/README.md | README.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.