Created
June 19, 2018 13:36
-
-
Save djbarnwal/9fd99dfdd7804c3128966bb5f0ec86e9 to your computer and use it in GitHub Desktop.
Titanic Survival
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Titanic Survival - iodide</title> | |
<link rel="stylesheet" type="text/css" href="iodide.dev.css"> | |
</head> | |
<body> | |
<script id="jsmd" type="text/jsmd"> | |
%% meta | |
{ | |
"title": "Titanic Survival", | |
"languages": { | |
"js": { | |
"pluginType": "language", | |
"languageId": "js", | |
"displayName": "Javascript", | |
"codeMirrorMode": "javascript", | |
"module": "window", | |
"evaluator": "eval", | |
"keybinding": "j", | |
"url": "" | |
}, | |
"py": { | |
"languageId": "py", | |
"displayName": "python", | |
"codeMirrorMode": "python", | |
"keybinding": "p", | |
"url": "https://iodide.io/pyodide-demo/pyodide.js", | |
"module": "pyodide", | |
"evaluator": "runPython", | |
"pluginType": "language" | |
} | |
}, | |
"lastExport": "2018-06-19T13:33:02.331Z" | |
} | |
%% plugin | |
{ | |
"languageId": "py", | |
"displayName": "python", | |
"codeMirrorMode": "python", | |
"keybinding": "p", | |
"url": "https://iodide.io/pyodide-demo/pyodide.js", | |
"module": "pyodide", | |
"evaluator": "runPython", | |
"pluginType": "language" | |
} | |
%% code {"language":"py"} | |
# Check if Python is working | |
import sys | |
sys.version | |
%% js | |
pyodide.loadPackage("pandas") | |
%% js | |
pyodide.loadPackage('matplotlib') | |
%% code {"language":"py"} | |
import pandas as pd | |
from matplotlib import pyplot as plt | |
import pyodide | |
%% code {"language":"py"} | |
df = pd.read_csv(pyodide.open_url("titanic.csv")) | |
df.head(10) | |
%% code {"language":"py"} | |
df.describe(include='all') | |
%% code {"language":"py"} | |
df['survived'].value_counts().plot(kind='bar', title='Death and Survival Counts',grid=True) | |
plt.show() | |
%% code {"language":"py"} | |
df['sex'].value_counts().plot(kind='bar', title='Sex') | |
plt.show() | |
</script> | |
<div id='page'></div> | |
<script src='iodide.dev.js'></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment