Continued Development on draft version of viz

This commit is contained in:
Walker Waylon Scott 2017-07-13 12:49:42 -05:00
parent b2315a3f2d
commit 951eadd5cd
93 changed files with 10856 additions and 73 deletions

View file

@ -1,7 +1,7 @@
<h2> Filter </h2>
<div class="container" padding:50px>
<div class="row" min-height:150px>
<div class='col-sm-1'></div>
{% for input in inputs %}
<div class='col-sm-3'>
{{ input }}:
@ -12,6 +12,7 @@
{% endfor %}
</div>
<div class="row" min-height:150px>
<div class='col-sm-1'></div>
{% for dropdown in dropdowns %}
<div class="col-sm-3">
{{ dropdown }}:

View file

@ -6,11 +6,11 @@
<!-- Load d3.js and c3.js -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud.css">
<script src='http://d3js.org/d3.v3.min.js' charset='utf-8'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/c3/0.4.8/c3.min.js'></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="static/node_modules/chosen-js/chosen.css">
<script src="static/node_modules/chosen-js/chosen.jquery.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud-1.0.4.min.js'></script>
<script src='static/node_modules/jqcloud2/src/jqcloud.js'></script>
<link rel='stylesheet' type='text/css' href='static/css/custom.css'>
@ -19,14 +19,33 @@
{% block body %}
{{ super ()}}
{{ form | safe }}
<div class="container" padding:50px>
<div class="container center" padding:50px>
<div class='row'>
<div class='col-sm-3'></div>
<div class='col-sm-1'>
Year: <div class='kpi' id='year'>
</div>
</div>
<div class='col-sm-1'>
Score: <div class='kpi' id='score'>
</div>
</div>
<div class='col-sm-4'>
Gross: <div class='kpi' id='gross' style='color:green'>
</div>
<div class='col-sm-9'></div>
</div>
</div>
<div class="row" min-height:150px>
<div class='col-sm-6'>
<div class='col-sm-12'>
<div id='timeseries-chart'></div>
</div>
</div>
<div class="row" min-height:150px>
<div class='col-sm-6'>
<div class='col-sm-6 centered'>
<div id='word_cloud'></div>
</div>
</div>

View file

@ -9,7 +9,7 @@
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href='https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.css' rel='stylesheet' type='text/css'/>
<link href='https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.8/c3.min.css' rel='stylesheet' type='text/css'/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

View file

@ -1,7 +1,7 @@
# pyDataVizDay
*a python implementation for Data Viz Day*
![python](https://www.python.org/static/opengraph-icon-200x200.png)
![python](https://s3.amazonaws.com/files.dezyre.com/images/blog/Python+for+Data+Science+vs.+Python+for+Web+Development/Python+for+Data+Science+vs+Web+Devlopment.png)
----
@ -17,22 +17,112 @@
----
## Pros
## Pros of Python
* Fast High Level Data Science
* reusable
* Powerful Web stack
* Testing
* Documentation
* Free
---
### Fast High Level Data Science
python has a vast ecosysytem for data wrangling
``` python
import pandas as pd
import glob, os
path = "C:/reports"
files = glob.glob(path + os.sep + '*_report.csv*')
frames = []
for file in files:
frames.append(pd.read_csv(file))
all_reports = (pd.concat(frames)
.dropna()
.query('DIVISION == ACCOUNTING')
)
```
---
### Reusability
Python libraries, and objects are very easily written and reused
```
import etl
data = etl.Data()
data.update()
```
---
### Testing
The ability to easily reuse code/datasets/plot gives us the ability to spend time making large projects more .
``` python
class Testdata(unittest.TestCase):
"""
Test suite for my dataframe data
"""
def test_cols(self):
for col in important_cols:
self.assertLess(len(data[data[col].isnull()]), 0, msg=f'column {col} has unexpected null values')
self.assertIn(col, data.columns.tolist(), msg=f'column {col} is missing - check the /data/raw/shipments.csv file to ensure logistics has not changed the data format')
```
---
### Testing *(cont.)*
Alert us of an error before it becomes an issue
``` python
suite = unittest.TestLoader().loadTestsFromModule(Testdata())
results = unittest.TextTestRunner().run(suite)
if test_results.wasSuccessful():
data.to_csv(settings.processed_data_dir + os.sep + 'processed_reports.csv')
else:
print('test failed, not saving reports')
```
---
## Documentation
* docstrings
* help()
* ?
* fully rendered sphinx docs
* comments when absolutely necessary
---
### Free
*enough said*
----
## Cons
## Cons on python
* No GUI (Drag and Drop Environment)
* Longer Learning Curve
*
* slow runtime compared to statically typed languages (c, java)
* Latest ML aglorithms are typically developed in R
----
@ -45,6 +135,7 @@
* C3
* reveal
* jquery
* jqcloud
* HTML
* Bootstrap
@ -65,6 +156,8 @@
* Many plugins (including reveal)
* Data/viz/slides All in one place
![jupyter notebook](http://jupyter.org/assets/jupyterpreview.png)
---
### Jupyter Dashboards
@ -80,18 +173,3 @@
* released in June
![dash](https://camo.githubusercontent.com/a1be75b74d4a47c50df7018e914d63a2e232e503/68747470733a2f2f63646e2d696d616765732d312e6d656469756d2e636f6d2f6d61782f3830302f312a44455441517136572d7079746c4e6f487a4c496144412e706e67)
----
# Example
* making sure highlighting works
``` python
import pandas as pd
l = [1, 2, 3]
for item in l:
print('this is an item from l')
print(l)
```