Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Code for generating Five-Question Summary reports.
# Import basic packages
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Read in student response data; change name of file as needed
col_names = ["Challenge", "Support", "Competence", "Autonomy",
"Relatedness"]
df = pd.read_csv('student_responses.csv', names = col_names)
# Create 2x2 for Challenge vs Support
cs = df.groupby(["Challenge", "Support"]).size().reset_index(name="Count")
plt.axes()
plt.xlim([0,6])
plt.ylim([0,6])
plt.xticks([1,2,3,4,5])
plt.yticks([1,2,3,4,5])
plt.xlabel("Challenge")
plt.ylabel("Support")
plt.grid(True)
plt.axvline(x=3, color='black')
plt.axhline(y=3, color='black')
cmap = plt.cm.get_cmap("cool")
plt.scatter(cs.Challenge, cs.Support, c = cs['Count'], s=300, cmap = cmap)
# Create 2x2 for Competence and Relatedness
comp_rel = df.groupby(["Competence", "Relatedness"]).size().reset_index(name="Count")
plt.axes()
plt.xlim([0,6])
plt.ylim([0,6])
plt.xticks([1,2,3,4,5])
plt.yticks([1,2,3,4,5])
plt.xlabel("Competence")
plt.ylabel("Relatedness")
plt.grid(True)
plt.axvline(x=3, color='black')
plt.axhline(y=3, color='black')
cmap = plt.cm.get_cmap("cool")
plt.scatter(comp_rel.Competence, comp_rel.Relatedness, c = comp_rel['Count'], cmap = cmap, s = 300)
# Create Autonomy boxplot
df.boxplot(['Autonomy'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.