This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import plotly | |
from plotly.graph_objs import Scatter, Layout | |
plotly.offline.init_notebook_mode(connected=True) | |
plo = plotly.offline.iplot | |
results = pd.read_excel('https://education.alberta.ca/media/3680582/diploma-multiyear-auth-list-annual.xlsx') | |
years = [] | |
for value in results.columns.values: | |
try: # check if first four digits are a number (a year) | |
year = value[0:4] | |
int(year) | |
if year not in years: | |
years.append(year) | |
except (TypeError, ValueError): | |
pass | |
schoolAuthority = 'Elk Island Public Schools Regional Division No. 14' | |
interestingRows = [] | |
for row in results.iterrows(): | |
if row[1]['Authority Name'] == schoolAuthority: | |
rowNumber = row[0] | |
interestingRows.append(rowNumber) | |
lookingFor = 'Auth School Mark % Exc' | |
x = years | |
y = [] | |
for rowNumber in interestingRows: | |
for year in years: | |
findThis = year + ' ' + lookingFor | |
y.append(results.iloc[rowNumber][findThis]) | |
plo({ | |
"data": [Scatter(x=x, y=y)], | |
"layout": Layout( | |
yaxis=dict(range=[0,100]), | |
title=results.iloc[rowNumber]['Diploma Course'] + '<br>' + lookingFor + '<br>' + schoolAuthority | |
) | |
}) | |
y = [] |
1 comment:
Love what you're doing with Jupyter notebooks in the schools! (or Jupyterlab..?)
I did want to suggest that you check out altair https://altair-viz.github.io/ as a plotting library.
(If you haven't already)
Very clean interface with options for interactive graphics.
good luck with this!
Joe
Post a Comment