ISHAP WorkShop code tutorial

First you would want to start off by importing our source code as seen below.


In [1]:
import devahp as h
import numpy as np
from plotly.offline import plot
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import plotly.graph_objs as go
init_notebook_mode()


[ 0.34554098  0.2453444   0.23955928  0.16955535]

Next you would want to calculate the vector for your excel sheet


In [2]:
h.single_stats("Areas.xlsx", "Sarah")


Out[2]:
array([ 0.17880869,  0.29666912,  0.17972793,  0.34479426])

In [3]:
h.single_stats('Jobs.xlsx', 'Sarah')


/home/wjadams/anaconda3/lib/python3.5/site-packages/openpyxl/reader/worksheet.py:322: UserWarning:

Unknown extension is not supported and will be removed

Out[3]:
array([ 0.24857039,  0.14602988,  0.20131877,  0.19501841,  0.20906255])

Next we are going to make the bar chart


In [4]:
drews = h.single_stats("Areas.xlsx", "Drew", )

In [5]:
altnames = h.get_altnames("Areas.xlsx")
data = go.Bar(x=["Math", "Animals", "Library", "Kitchen"], y=drews)
layout = go.Layout(title = "Drew's Priorities")
iplot(go.Figure(data = go.Data([data]), layout = layout))



In [20]:
from openpyxl import load_workbook
wb = load_workbook(filename = 'Areas.xlsx')
firstsheet = wb.get_sheet_names()[0]
sheet = wb.get_sheet_by_name(firstsheet)

Here we are going to use the single stats function


In [6]:
#As you can see we are printing out the raw numbers
#You start with the file name then the sheet name
h.single_stats("Areas.xlsx", "Sarah")


Out[6]:
array([ 0.17880869,  0.29666912,  0.17972793,  0.34479426])

We can automaticially show the graph with this function.


In [9]:
#You can repeat what we did before but add "True" after to print out a bar chart
h.single_stats("Areas.xlsx", "Sarah",bars = True)


And we can automaticially see the doppelganger effect.

As you can see in the first example that Math and Library were very similar but when we apply the doppelganger effect they are very differnt


In [10]:
h.single_stats("Areas.xlsx", "Sarah", bars = True, doppelganger = True)


We can also change better and muchbetter.

Notice that Math loses to Animals before but now Math wins.


In [11]:
h.single_stats("Areas.xlsx", "Sarah", bars = True, better = 1.5, muchbetter = 2, doppelganger = True)


Next we are going to use the group_stats function.


In [12]:
h.group_stats("Areas.xlsx", bars = True)


Next we are going to change better and muchbetter in group_stats


In [26]:
h.group_stats("Areas.xlsx", bars = True, better = 1.5, muchbetter = 2)


Next we are going to use the Doppelganger Effect with group_stats


In [27]:
h.group_stats("Areas.xlsx", bars = True, better = 1.5, muchbetter = 2, doppelganger = True)


You can also choose which sheets you want to use


In [28]:
h.group_stats("Areas.xlsx", ["Sarah", "Drew"], bars = True, better = 1.5, muchbetter = 2, doppelganger = True)



In [ ]: