Package: topsisAnant102003755
Topsis Score Calculator (topsisAnant102003755)For:Assignment - Topsis (UCS654)Submitted by:Anant MishraRoll no:102003755Subgroup:3COE25DescriptionTopsisTOPSIS(Technique for order performance by similarity to ideal solution)is a useful technique in dealing with multi-attribute or multi-criteria decision making (MADM/MCDM) problems in the real world. It is a method of ranking alternatives, which are represented by vectors in a multi-dimensional space. The method is based on the Euclidean distance between the alternatives and the ideal and negative-ideal solutions.topsisAnant102003755This is a python library for calculating theTopsis score of a given csv file.It takes the csv file name, weights vector and impacts vector as input and returns the Topsis score and rank of each row in the csv file.InstallationUsing package managerpipinstall topsisAnant102003755.pipinstalltopsisAnant102003755UsageIn code as a libraryInputfromtopsis.topsisimporttopsis# Weights and Impacts are accepted in both list and string formatdf=topsis.calculate("sample.csv","0.25,0.25,0.25,0.25","+,+,-,+",output_file="output.csv",verbose=True,force=True)# ORdf=topsis.calculate("sample.csv",[0.25,0.25,0.25,0.25],['+','+','-','+'],output_file="output.csv",verbose=True,force=True)OutputTop 5 attributes with highest topsis score:
+-------------------------+-----------------+-----------------+----------+---------+----------------+--------+
| Attribute Or Criteria   |   Price or Cost |   Storage Space |   Camera |   Looks |   Topsis Score |   Rank |
|-------------------------+-----------------+-----------------+----------+---------+----------------+--------|
| Mobile 4                |             275 |              32 |        8 |       4 |         0.796  |      1 |
| Mobile 3                |             300 |              32 |       16 |       4 |         0.5776 |      2 |
| Mobile 1                |             250 |              16 |       12 |       5 |         0.5343 |      3 |
| Mobile 2                |             200 |              16 |        8 |       3 |         0.4224 |      4 |
| Mobile 5                |             225 |              16 |       16 |       2 |         0.0727 |      5 |
+-------------------------+-----------------+-----------------+----------+---------+----------------+--------+Commandline usagetopsis-i<csvfilename>-w=<weightsvector>-p=<impactsvector>-o<outputfilename>-fArguments-i, --input: csv file name-w, --weights: weights vector-p, --impacts: impacts vector-o, --output: output file name-f, --force: force overwrite of output fileHelp$topsis-h

usage:topsis[-h]-iINPUT[-oOUTPUT][-wWEIGHTS][-pIMPACTS][-f]TopsisScoreCalculator

optionalarguments:-h,--helpshowthishelpmessageandexit-iINPUT,--inputINPUTInputfilepathincsvorxlsxformat-oOUTPUT,--outputOUTPUTOutputfilepathincsvorxlsxformat-wWEIGHTS,--weightsWEIGHTSWeightsseparatedbycomma-pIMPACTS,--impactsIMPACTSImpactsseparatedbycomma(either+or-)-f,--forceOverwriteoutputfileifitalreadyexistsExamplesample.csvA csv file showing data for different mobile handsets having varying features.ModelStorage space(in gb)Camera(in MP)Price(in $)Looks(out of 5)Mobile 116122505Mobile 21682003Mobile 332163004Mobile 43282754Mobile 516162252weights vector = [ 0.25 , 0.25 , 0.25 , 0.25 ]impacts vector = [ + , + , - , + ]Input:topsis-imydata.csv-w="0.25,0.25,0.25,0.25"-p="+,+,-,+"-ooutput.csv-fOutput:Weights:  [0.25 0.25 0.25 0.25]
Impacts:  ['+' '+' '-' '+']

Top 5 attributes with highest topsis score:
+-------------------------+-----------------+-----------------+----------+---------+----------------+--------+
| Attribute Or Criteria   |   Price or Cost |   Storage Space |   Camera |   Looks |   Topsis Score |   Rank |
|-------------------------+-----------------+-----------------+----------+---------+----------------+--------|
| Mobile 4                |             275 |              32 |        8 |       4 |         0.796  |      1 |
| Mobile 3                |             300 |              32 |       16 |       4 |         0.5776 |      2 |
| Mobile 1                |             250 |              16 |       12 |       5 |         0.5343 |      3 |
| Mobile 2                |             200 |              16 |        8 |       3 |         0.4224 |      4 |
| Mobile 5                |             225 |              16 |       16 |       2 |         0.0727 |      5 |
+-------------------------+-----------------+-----------------+----------+---------+----------------+--------+ContributingPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.LicenseMIT