Modern...ish Vocational Testing
Holla(nd) mundo!¶
The Holland Occupational Themes is a theory of personality focused on the vocational profile. It attempts to measure the affinity to six different categories of occupations. The six types yield the "RIASEC" acronym, by which the theory is popularly known in the field of career counseling.
We go through the following steps:
- Loading of example data
- Minimal exploration with pandas
- Result dashboard with plotly
You can take the test online in: https://openpsychometrics.org/tests/RIASEC/
In [13]:
HTML(holla)
Out[13]:
In [2]:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
sns.set()
In [3]:
def score(respuestas : list):
"""Function to score Holland test. Questions are grouped periodically, p=6.
"""
return {cat: len([r for r in respuestas if int(r) in [i for i in range(categorias.index(cat) + 1, 91, 6)]]) for cat in categorias}
In [4]:
categorias = 'R,I,A,S,E,C'.split(',')
me = '1,2,3,4,8,9,10,13,14,15,16,19,20,22,23,24,25,26,27,28,29,30,31,32,33,34,43,44,45,46,47,51,52,53,56,57,58,61,62,63,68,70,71,73,74,75,79,81,87,89,90'.split(',')
In [5]:
score(me)
Out[5]:
In [6]:
# Some sample data
nombres = 'mati, giuli, fer v, mago, consu, delfi, meli, fer p, peter'.split(', ')
data = np.array([
[9, 11, 12, 10, 6, 3],
[12, 14, 12, 14, 12, 12],
[11, 9, 6, 8, 7, 7],
[1, 13, 6, 10, 7, 0],
[6, 7, 0, 7, 4, 8],
[2, 7, 4, 11, 7, 9],
[3, 9,7,13, 8, 9],
[3, 7, 5, 7, 6, 1],
[5, 6, 2, 4, 2, 2]]
)
In [7]:
df = pd.DataFrame(data, columns = categorias, index = nombres)
df.describe().round(1)
Out[7]:
In [8]:
sns.set(rc={'figure.figsize':(25,5)})
ax = df.plot.bar()
for p in ax.patches:
ax.annotate(str(p.get_height()), (p.get_x() * 1.0, p.get_height() * 1.04), rotation=50)
plt.xticks(rotation=45);
In [9]:
from IPython.display import HTML
import plotly.offline as py
import plotly.graph_objs as go
from plotly.subplots import make_subplots
py.offline.init_notebook_mode(connected=True)
In [10]:
data = [go.Scatterpolar(
r = df.iloc[i].values,
theta = df.columns,
fill = 'toself',
name = df.index[i],
hovertemplate = '%{r}'
) for i in range(df.shape[0])]
layout = go.Layout(
polar = dict(
radialaxis = dict(
visible = False,
)
),
showlegend = True
)
fig = go.Figure(data=data, layout=layout)
HTML(py.plot(fig, output_type='div'))
Out[10]:
In [11]:
n_person = 0
serie = df.loc[:, list('AIRCES')].iloc[n_person]
tipo = serie.idxmax()
diferenciacion = serie.max() - serie.min()
In [12]:
fig = make_subplots(rows=1, cols=2,
specs=[[{"type": "xy"}, {"type": "polar"}]])
fig.add_trace(
go.Scatterpolar(
r = serie.values,
theta = serie.index,
fill = 'toself',
name = serie.name,
hovertemplate = '%{r}',
hoverlabel = dict(font=dict(size=20)),
),
row=1, col=2
)
serie.sort_values(ascending=False, inplace=True)
fig.add_trace(
go.Bar(
x= serie.index,
y= serie.values,
hovertemplate = '%{y}',
hoverlabel = dict(font=dict(size=20)),
name = serie.name,
marker={'color':serie.values, 'colorscale': 'Blues'}
),
row=1, col=1
)
fig.update_layout(
polar = dict(
radialaxis = dict(
visible = False,
)),
title = go.layout.Title(
text = f'Diferenciación: {diferenciacion} \n Tipo: {tipo}',
xref = "container",
x=0.5),
title_font=dict(
size=40),
font=dict(family='Courier New, monospace',
size=18,
color='#7f7f7f'),
showlegend = False
)
holla = py.plot(fig, output_type='div')
Comments
Comments powered by Disqus