├── setup.cfg
├── requirements.txt
├── enable_ipypivot.json
├── ipypivot
├── _config.py
├── __meta__.py
├── __init__.py
├── markdown
│ └── pivotui.md
├── _sample.py
├── _state.py
├── _options.py
├── _widget_pivot.py
├── _widget_util.py
├── api
│ ├── pivot.tsv
│ ├── pivot.json
│ ├── pivotui.tsv
│ ├── pivotui.json
│ └── create_api_json.ipynb
├── _widget_pivotui_box.py
├── _widget_pivotui.py
├── _wrapper.py
└── data
│ ├── iris.csv
│ ├── create_tips_csv.ipynb
│ ├── tips.csv
│ ├── weather.csv
│ ├── mps.csv
│ └── tips.json
├── MANIFEST.in
├── .gitignore
├── js
├── README.md
├── lib
│ ├── widget.js
│ ├── embed.js
│ ├── extension.js
│ ├── index.js
│ ├── style.css
│ ├── util.js
│ ├── widget_pivotui.js
│ ├── widget_pivot.js
│ ├── widget_pivotui_box.js
│ ├── pivot-table.css
│ ├── c3.css
│ └── pivot-table.js
├── LICENSE
├── package.json
└── webpack.config.js
├── LICENSE
├── README.md
└── setup.py
/setup.cfg:
--------------------------------------------------------------------------------
1 | [bdist_wheel]
2 | universal=1
3 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | ipywidgets>=7.1.0
2 | widgetsnbextension>=3.1.0
3 | notebook>=5.3.0
4 | pandas>=0.22.0
5 |
--------------------------------------------------------------------------------
/enable_ipypivot.json:
--------------------------------------------------------------------------------
1 | {
2 | "load_extensions": {
3 | "ipypivot/extension": true
4 | }
5 | }
6 |
--------------------------------------------------------------------------------
/ipypivot/_config.py:
--------------------------------------------------------------------------------
1 |
2 | API_DIR = 'api'
3 | SCRIPTS_DIR = 'scripts'
4 |
5 | PIVOT_OPTION_FILE = 'pivot.json'
6 | PIVOTUI_OPTION_FILE = 'pivotui.json'
7 |
8 | NAME = 'Key '
9 | TYPE = 'Type '
10 | DEFAULT = 'Default value '
11 | DESCRIPTION = 'Description'
12 |
--------------------------------------------------------------------------------
/MANIFEST.in:
--------------------------------------------------------------------------------
1 |
2 | # js
3 | recursive-include ipypivot/static *.*
4 |
5 | # subfolders
6 | recursive-include ipypivot/api *.json
7 | recursive-include ipypivot/data *.csv
8 | recursive-include ipypivot/markdown *.md
9 |
10 | # Misc
11 | include requirements.txt
12 | include LICENSE
13 | global-exclude *.py[co]
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .DS_Store
3 | .vs_code/
4 |
5 | *.py[cod]
6 | */__pycache__/
7 | *.ipynb_checkpoints/
8 | *.egg-info/
9 |
10 | */package-lock.json
11 | */node_modules/
12 |
13 | */static/
14 | js/dist/
15 |
16 | setup.orig.py
17 | setup.orig2.py
18 |
19 | notebooks/*.html
20 | notebooks/*.sh
21 | notebooks/*.js
22 |
23 | dist/
24 | build/
25 |
26 | */*.tgz
27 | package/
28 |
29 | *.old*
30 | *test*
31 | js/temp.*
32 |
33 |
--------------------------------------------------------------------------------
/js/README.md:
--------------------------------------------------------------------------------
1 |
2 | # `ipypivot` Javascript part
3 |
4 |
5 | This is the javascript part of a demo [jupyter-widget](https://ipywidgets.readthedocs.io/en/stable/).
6 |
7 | Check out the [ipypivot repo](https://github.com/PierreMarion23/ipypivot) for more info.
8 |
9 |
10 | ## 1 - Prerequisite
11 |
12 | Install [node](http://nodejs.org/).
13 |
14 | ## 2 - Install
15 |
16 | ```bash
17 | npm install --save ipypivot
18 | ```
19 |
--------------------------------------------------------------------------------
/ipypivot/__meta__.py:
--------------------------------------------------------------------------------
1 |
2 | def _get_version(version_info):
3 | dic = {'alpha': 'a',
4 | 'beta': 'b',
5 | 'candidate': 'rc',
6 | 'final': ''}
7 | vi = version_info
8 | specifier = '' if vi[3] == 'final' else dic[vi[3]] + str(vi[4])
9 | version = '%s.%s.%s%s' % (vi[0], vi[1], vi[2], specifier)
10 | return version
11 |
12 |
13 | # meta data
14 |
15 | version_info = (0, 2, 7, 'final', 0)
16 | __version__ = _get_version(version_info)
17 |
--------------------------------------------------------------------------------
/js/lib/widget.js:
--------------------------------------------------------------------------------
1 |
2 | 'use strict';
3 |
4 | var pivot = require('./widget_pivot');
5 | var pivotui = require('./widget_pivotui');
6 | var pivotui_box = require('./widget_pivotui_box');
7 |
8 |
9 | module.exports = {
10 | PivotModel: pivot.PivotModel,
11 | PivotView: pivot.PivotView,
12 | PivotUIModel: pivotui.PivotUIModel,
13 | PivotUIView: pivotui.PivotUIView,
14 | PivotUIBoxModel: pivotui_box.PivotUIBoxModel,
15 | PivotUIBoxView: pivotui_box.PivotUIBoxView
16 | };
17 |
18 |
--------------------------------------------------------------------------------
/js/lib/embed.js:
--------------------------------------------------------------------------------
1 | // Entry point for the unpkg bundle containing custom model definitions.
2 | //
3 | // It differs from the notebook bundle in that it does not need to define a
4 | // dynamic baseURL for the static assets and may load some css that would
5 | // already be loaded by the notebook otherwise.
6 |
7 | // Export widget models and views, and the npm package version number.
8 | module.exports = require('./widget.js');
9 | module.exports['version'] = require('../package.json').version;
10 |
--------------------------------------------------------------------------------
/ipypivot/__init__.py:
--------------------------------------------------------------------------------
1 |
2 | from .__meta__ import __version__
3 |
4 | from ._widget_pivot import Pivot
5 | # from ._widget_pivotui import PivotUI
6 | from ._widget_pivotui_box import PivotUIBox as PivotUI
7 | from ._options import Pivot_Options, PivotUI_Options
8 | from ._sample import samples
9 |
10 |
11 | def _jupyter_nbextension_paths():
12 | return [{
13 | 'section': 'notebook',
14 | 'src': 'static',
15 | 'dest': 'ipypivot',
16 | 'require': 'ipypivot/extension'
17 | }]
18 |
--------------------------------------------------------------------------------
/ipypivot/markdown/pivotui.md:
--------------------------------------------------------------------------------
1 | + The `PivotUI` object say `p` has 2 buttons:
2 | + **Save** to snapshot the current state and access with `p.table.df_export` (dataframe) and `p.table.options` (dict)
3 | + Options which are javascript functions are discarded when passed to Python
4 | + The first snapshot takes place immediately after creation as recorded by the timestamp right of the buttons
5 | + However there is a slight delay - so wait for say 0.2s to access it (ie add `sleep(0.2)` in a notebook)
6 | + **Restore** to apply the options saved
7 |
8 |
--------------------------------------------------------------------------------
/js/lib/extension.js:
--------------------------------------------------------------------------------
1 |
2 | // This file contains the javascript that is run when the notebook is loaded.
3 | // It contains some requirejs configuration and the `load_ipython_extension`
4 | // which is required for any notebook extension.
5 |
6 | // Configure requirejs
7 | if (window.require) {
8 | window.require.config({
9 | map: {
10 | "*": {
11 | "ipypivot": "nbextensions/ipypivot/index",
12 | }
13 | }
14 | });
15 | }
16 |
17 | // Export the required load_ipython_extension
18 | module.exports = {
19 | load_ipython_extension: function () { }
20 | };
21 |
--------------------------------------------------------------------------------
/js/lib/index.js:
--------------------------------------------------------------------------------
1 |
2 | // Entry point for the notebook bundle containing custom model definitions.
3 | //
4 | // Setup notebook base URL
5 | //
6 | // Some static assets may be required by the custom widget javascript. The base
7 | // url for the notebook is not known at build time and is therefore computed
8 | // dynamically.
9 | __webpack_public_path__ = document.querySelector('body').getAttribute('data-base-url') + 'nbextensions/ipypivot/';
10 |
11 | // Export widget models and views, and the npm package version number.
12 | module.exports = require('./widget.js');
13 | module.exports['version'] = require('../package.json').version;
14 |
--------------------------------------------------------------------------------
/ipypivot/_sample.py:
--------------------------------------------------------------------------------
1 |
2 | import os
3 | import pandas as pd
4 |
5 |
6 | class Samples:
7 | """
8 | """
9 |
10 | def __init__(self):
11 | """
12 | """
13 | _dir = os.path.dirname(os.path.realpath(__file__))
14 |
15 | path = os.path.join(_dir, 'data', 'tips.csv')
16 | self.df_tips = pd.read_csv(path)
17 |
18 | path = os.path.join(_dir, 'data', 'mps.csv')
19 | self.df_mps = pd.read_csv(path)
20 |
21 | path = os.path.join(_dir, 'data', 'weather.csv')
22 | self.df_weather = pd.read_csv(path)
23 |
24 | path = os.path.join(_dir, 'data', 'iris.csv')
25 | self.df_iris = pd.read_csv(path)
26 |
27 |
28 | samples = Samples()
29 |
--------------------------------------------------------------------------------
/ipypivot/_state.py:
--------------------------------------------------------------------------------
1 |
2 | import os
3 | import json
4 | from ._config import API_DIR, PIVOT_OPTION_FILE, PIVOTUI_OPTION_FILE
5 |
6 |
7 | class State(object):
8 | """
9 | Contains all 'ezvis3d' API, options and methods
10 | """
11 |
12 | def __init__(self, src):
13 | """
14 | """
15 | self._OPTION = self._load_resource(src)
16 |
17 | def _load_resource(self, src):
18 | """
19 | """
20 | _dir = os.path.dirname(__file__)
21 | path = os.path.join(_dir, API_DIR, src)
22 | with open(path, 'r') as f:
23 | return json.load(f)
24 |
25 |
26 | state_Pivot = State(PIVOT_OPTION_FILE)
27 | state_PivotUI = State(PIVOTUI_OPTION_FILE)
28 |
--------------------------------------------------------------------------------
/js/lib/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: Verdana;
3 | }
4 | .node {
5 | border: solid 1px white;
6 | font: 10px sans-serif;
7 | line-height: 12px;
8 | overflow: hidden;
9 | position: absolute;
10 | text-indent: 2px;
11 | }
12 | .c3-line, .c3-focused {
13 | stroke-width: 3px !important;
14 | }
15 | .c3-bar {
16 | stroke: white !important;
17 | stroke-width: 1;
18 | }
19 | .c3 text {
20 | font-size: 12px;
21 | color: grey;
22 | }
23 | .tick line {
24 | stroke: white;
25 | }
26 | .c3-axis path {
27 | stroke: grey;
28 | }
29 | .c3-circle {
30 | opacity: 1 !important;
31 | }
32 | .c3-xgrid-focus {
33 | visibility: hidden !important;
34 | }
35 |
36 | .pivot-buttons {
37 | display: flex;
38 | justify-content: space-between;
39 | width: 300px;
40 | }
41 |
42 | .pivot-buttons button {
43 | background-color: lightgray;
44 | }
45 |
46 | .last-saved {
47 | font-weight: bold;
48 | }
49 |
--------------------------------------------------------------------------------
/js/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Olivier Borderies
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2018 Olivier Borderies, Olivier Coudray, Pierre Marion
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/js/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "ipypivot",
3 | "version": "0.1.1",
4 | "description": "A Custom Jupyter Widget Library",
5 | "author": "oscar6echo",
6 | "license": "MIT",
7 | "main": "dist/index.js",
8 | "repository": {
9 | "type": "git",
10 | "url": "https://github.com/PierreMarion23/ipypivot"
11 | },
12 | "keywords": [
13 | "jupyter",
14 | "widgets",
15 | "ipython",
16 | "ipywidgets",
17 | "pivottable"
18 | ],
19 | "files": [
20 | "dist/*.js"
21 | ],
22 | "scripts": {
23 | "clean": "rimraf dist/ && rimraf ../ipypivot/static/",
24 | "cleanall": "npm run clean && rimraf node_modules/",
25 | "prepare": "webpack",
26 | "watch": "watch 'npm run prepare' lib/",
27 | "test": "echo \"Error: no test specified\" && exit 1"
28 | },
29 | "devDependencies": {
30 | "css-loader": "^0.28.7",
31 | "less": "^2.7.2",
32 | "less-loader": "^4.0.5",
33 | "rimraf": "^2.6.1",
34 | "style-loader": "^0.18.2",
35 | "watch": "^1.0.2",
36 | "webpack": "^3.10.0"
37 | },
38 | "dependencies": {
39 | "@jupyter-widgets/base": "^1.1.8",
40 | "@jupyter-widgets/controls": "^1.1.5",
41 | "c3": "^0.4.18",
42 | "d3": "^3.5.5",
43 | "jquery": "^3.2.1",
44 | "jquery-ui-bundle": "^1.12.1",
45 | "pivottable": "^2.18.0"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/ipypivot/_options.py:
--------------------------------------------------------------------------------
1 |
2 | from ._wrapper import Wrapper
3 | from ._state import state_Pivot, state_PivotUI
4 |
5 |
6 | class Pivot_Options(Wrapper):
7 | """
8 | Options for Pivot object
9 |
10 | Ref: https://github.com/nicolaskruchten/pivottable/wiki/Parameters#options-object-for-pivot
11 | """
12 |
13 | def __init__(self, pivot):
14 | Wrapper.__init__(self, state_Pivot)
15 | self._pivot = pivot
16 |
17 | def __setattr__(self, attr, value):
18 | object.__setattr__(self, attr, value)
19 | if attr != '_pivot' and attr != 'path' and attr != 'state': # necessary to avoid errors
20 | self._pivot._counter += 1
21 |
22 | def __repr__(self):
23 | return str(self.to_dict())
24 |
25 |
26 | class PivotUI_Options(Wrapper):
27 | """
28 | Options for Pivot object
29 |
30 | Ref: https://github.com/nicolaskruchten/pivottable/wiki/Parameters#options-object-for-pivotui
31 | """
32 |
33 | def __init__(self, pivot):
34 | Wrapper.__init__(self, state_PivotUI)
35 | self._pivot = pivot
36 |
37 | def __setattr__(self, attr, value):
38 | object.__setattr__(self, attr, value)
39 | if attr != '_pivot' and attr != 'path' and attr != 'state': # necessary to avoid errors
40 | self._pivot._counter += 1
41 |
42 | def __repr__(self):
43 | return str(self.to_dict())
44 |
--------------------------------------------------------------------------------
/ipypivot/_widget_pivot.py:
--------------------------------------------------------------------------------
1 |
2 | import ipywidgets as widgets
3 | import pandas as pd
4 | from copy import deepcopy
5 |
6 |
7 | from traitlets import observe
8 | from traitlets import Unicode, Dict, List, Int
9 |
10 | from io import StringIO
11 |
12 | from ._options import Pivot_Options
13 |
14 |
15 | @widgets.register
16 | class Pivot(widgets.DOMWidget):
17 | """An example widget."""
18 | _view_name = Unicode('PivotView').tag(sync=True)
19 | _model_name = Unicode('PivotModel').tag(sync=True)
20 | _view_module = Unicode('ipypivot').tag(sync=True)
21 | _model_module = Unicode('ipypivot').tag(sync=True)
22 | _view_module_version = Unicode('~0.1.1').tag(sync=True)
23 | _model_module_version = Unicode('~0.1.1').tag(sync=True)
24 |
25 | _data = List([]).tag(sync=True)
26 | _options = Dict({}).tag(sync=True)
27 | _counter = Int(0)
28 |
29 | def __init__(self,
30 | df_data=None):
31 | """
32 | """
33 | super().__init__()
34 | self.options = Pivot_Options(self)
35 |
36 | if df_data is not None:
37 | arr = df_data.values.tolist()
38 | arr.insert(0, list(df_data.columns))
39 | self._data = arr
40 |
41 | self.df_data = df_data.copy()
42 |
43 | @observe('_counter')
44 | def change_options(self, change):
45 | # print('change')
46 | self._options = self.options.to_dict()
47 |
--------------------------------------------------------------------------------
/ipypivot/_widget_util.py:
--------------------------------------------------------------------------------
1 |
2 |
3 | import pandas as pd
4 |
5 |
6 | def shape_df(df,
7 | options):
8 | """
9 | Build multi index dataframe from pivottable.js data
10 | """
11 |
12 | row_names = options['rows']
13 | col_names = options['cols']
14 |
15 | if row_names and col_names:
16 | df2 = df.set_index(row_names)
17 |
18 | row_idx = df2.index
19 | data = df2.values
20 |
21 | col_tuples = [tuple(e.split('-'))
22 | for e in list(df.columns[len(row_names):])]
23 |
24 | col_idx = pd.MultiIndex.from_tuples(tuples=col_tuples,
25 | names=col_names)
26 |
27 | df_res = pd.DataFrame(data=data,
28 | index=row_idx,
29 | columns=col_idx)
30 |
31 | elif row_names and not col_names:
32 | df2 = df.set_index(row_names)
33 |
34 | df_res = pd.DataFrame(df2)
35 |
36 | elif not row_names and col_names:
37 | row_idx = df.index
38 | data = df.values
39 |
40 | col_tuples = [tuple(e.split('-'))
41 | for e in list(df.columns)]
42 |
43 | col_idx = pd.MultiIndex.from_tuples(tuples=col_tuples,
44 | names=col_names)
45 |
46 | df_res = pd.DataFrame(data=data,
47 | index=row_idx,
48 | columns=col_idx)
49 |
50 | else:
51 |
52 | df_res = pd.DataFrame()
53 |
54 | return df_res
55 |
--------------------------------------------------------------------------------
/js/lib/util.js:
--------------------------------------------------------------------------------
1 |
2 | 'use strict';
3 |
4 | // these lib may be used in functions input as string by user
5 | var $ = require('jquery');
6 | var c3 = require('c3');
7 | var d3 = require('d3');
8 |
9 | var JSONPivotTable = {};
10 |
11 | JSONPivotTable.stringify = function (obj) {
12 | return JSON.stringify(obj, function (key, value) {
13 | return (typeof value === 'function') ? value.toString() : value;
14 | });
15 | };
16 |
17 | JSONPivotTable.parse = function (str) {
18 | return JSON.parse(str, function (key, value) {
19 | if (typeof value != 'string') return value;
20 |
21 | var valueCompact = value.replace(/\s+/g, '').replace(/\r?\n|\r/g, '');
22 | var r;
23 |
24 | if (valueCompact.substring(0, 8) == 'function') {
25 | // console.log('pos function - key: ' + key + ', value: ' + value);
26 | r = eval('(' + value + ')');
27 | // console.log('post eval');
28 | // console.log(r);
29 | return r;
30 | }
31 | else if (valueCompact.substring(0, 16) == '$.pivotUtilities') {
32 | r = eval('(' + value + ')');
33 | return r;
34 | }
35 | else if (valueCompact.substring(0, 8) == '$.extend') {
36 | r = eval('(' + value + ')');
37 | return r;
38 | }
39 | else {
40 | return value;
41 | }
42 | });
43 | };
44 |
45 | var formatDate = function (d) {
46 | // var options = {
47 | // month: 'short',
48 | // day: 'numeric',
49 | // hour: '2-digit',
50 | // minute: '2-digit',
51 | // second: '2-digit'
52 | // };
53 | // return d.toLocaleDateString('en-US', options);
54 |
55 | var dateStr = d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
56 | return dateStr;
57 | };
58 |
59 |
60 | var util = {
61 | JSONPivotTable: JSONPivotTable,
62 | formatDate: formatDate
63 | };
64 |
65 | module.exports = util;
--------------------------------------------------------------------------------
/js/lib/widget_pivotui.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | var widgets = require("@jupyter-widgets/base");
4 | var $ = require("jquery");
5 | var pivot_table = require("./pivot-table");
6 | require("./style.css");
7 |
8 | // Custom Model. Custom widgets models must at least provide default values
9 | // for model attributes, including
10 | //
11 | // - `_view_name`
12 | // - `_view_module`
13 | // - `_view_module_version`
14 | //
15 | // - `_model_name`
16 | // - `_model_module`
17 | // - `_model_module_version`
18 | //
19 | // when different from the base class.
20 |
21 | // When serialiazing the entire widget state for embedding, only values that
22 | // differ from the defaults will be specified.
23 |
24 | var PivotUIModel = widgets.DOMWidgetModel.extend({
25 | defaults: $.extend(widgets.DOMWidgetModel.prototype.defaults(), {
26 | _model_name: "PivotUIModel",
27 | _view_name: "PivotUIView",
28 | _model_module: "ipypivot",
29 | _view_module: "ipypivot",
30 | _model_module_version: "~0.1.1",
31 | _view_module_version: "~0.1.1",
32 | _data: [],
33 | _options: {},
34 | _data_tsv: ""
35 | })
36 | });
37 |
38 | var PivotUIView = widgets.DOMWidgetView.extend({
39 | render: function() {
40 | console.log("ipypivot PivotUIModel start render");
41 |
42 | // explicit
43 | var that = this;
44 |
45 | // build pivottable and append it to dom
46 | pivot_table.createPivotUI(that);
47 |
48 | // event listener
49 | that.model.on("change:_options", that.options_changed, that);
50 |
51 | // debug
52 | window.dom = that.el;
53 | },
54 |
55 | options_changed: function() {
56 | console.log("options changed");
57 | var that = this;
58 | pivot_table.call_pivottablejs(that, "pivotui", "update");
59 | }
60 | });
61 |
62 | module.exports = {
63 | PivotUIModel: PivotUIModel,
64 | PivotUIView: PivotUIView
65 | };
66 |
--------------------------------------------------------------------------------
/ipypivot/api/pivot.tsv:
--------------------------------------------------------------------------------
1 | Key Type Default value Description
2 | rows array of strings [] array of attribute names to use as rows
3 | cols array of strings [] array of attribute names for use as columns
4 | aggregator function $.pivotUtilities .aggregators["Count"]() constructor for an object which will aggregate results per cell (see documentation)
5 | aggregatorName string "Count" Name of the aggregator, used for display purposes in some renderers
6 | renderer function table() generates output from pivot data structure (see documentation)
7 | rowOrder string "key_a_to_z" the order in which row data is provided to the renderer, must be one of "key_a_to_z", "value_a_to_z", "value_z_to_a", ordering by value orders by row total
8 | colOrder string "key_a_to_z" the order in which column data is provided to the renderer, must be one of "key_a_to_z", "value_a_to_z", "value_z_to_a", ordering by value orders by column total
9 | derivedAttributes object of functions {} object to define derived attributes (see documentation)
10 | dataClass function $.pivotUtilities.PivotData Constructor for the data class to be built and passed to the Renderer (should be a subclass of the default)
11 | filter function function(){return true;} called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise
12 | sorters object or function {} accessed or called with an attribute name and can return a function which can be used as an argument to array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in "natural sort" implementation. Useful for sorting attributes like month names, see example 1 and example 2.
13 | rendererOptions object {} object passed through to renderer as options
14 | localeStrings object en strings locale-specific strings for error messages (see locale parameter below)
15 |
--------------------------------------------------------------------------------
/js/lib/widget_pivot.js:
--------------------------------------------------------------------------------
1 |
2 | "use strict";
3 |
4 | var widgets = require("@jupyter-widgets/base");
5 | var $ = require("jquery");
6 | var pivot_table = require("./pivot-table");
7 | // var util = require('./util');
8 | require("./style.css");
9 |
10 | // Custom Model. Custom widgets models must at least provide default values
11 | // for model attributes, including
12 | //
13 | // - `_view_name`
14 | // - `_view_module`
15 | // - `_view_module_version`
16 | //
17 | // - `_model_name`
18 | // - `_model_module`
19 | // - `_model_module_version`
20 | //
21 | // when different from the base class.
22 |
23 | // When serialiazing the entire widget state for embedding, only values that
24 | // differ from the defaults will be specified.
25 |
26 | var PivotModel = widgets.DOMWidgetModel.extend({
27 | defaults: $.extend(widgets.DOMWidgetModel.prototype.defaults(), {
28 | _model_name: "PivotModel",
29 | _view_name: "PivotView",
30 | _model_module: "ipypivot",
31 | _view_module: "ipypivot",
32 | _model_module_version: "~0.1.1",
33 | _view_module_version: "~0.1.1",
34 | _data: [],
35 | _options: {}
36 | })
37 | });
38 |
39 | var PivotView = widgets.DOMWidgetView.extend({
40 | render: function() {
41 | console.log("ipypivot PivotModel start render");
42 |
43 | // explicit
44 | var that = this;
45 |
46 | // build pivottable and append it to dom
47 | pivot_table.createPivot(that);
48 |
49 | // event listener
50 | that.model.on("change:_options", that.options_changed, that);
51 |
52 | var message = document.createElement("div");
53 | message.className = "last-saved";
54 | // message.innerHTML = 'Last Save ' + util.formatDate(new Date());
55 | this.message = message;
56 |
57 | this.el.insertBefore(message, this.el.firstChild);
58 |
59 | // debug
60 | // window.dom = that.el;
61 | },
62 |
63 | options_changed: function() {
64 | console.log("options changed");
65 | var that = this;
66 | // that.message.innerHTML = 'Last Save ' + util.formatDate(new Date());
67 | pivot_table.call_pivottablejs(that, "pivot", "update");
68 | }
69 | });
70 |
71 | module.exports = {
72 | PivotModel: PivotModel,
73 | PivotView: PivotView
74 | };
75 |
--------------------------------------------------------------------------------
/ipypivot/_widget_pivotui_box.py:
--------------------------------------------------------------------------------
1 | import os
2 | import datetime as dt
3 | import ipywidgets as widgets
4 |
5 |
6 | from IPython.display import display, Markdown
7 | from ipywidgets import Button, HTML, Layout, Box, HBox, VBox
8 | from traitlets import Unicode
9 |
10 | from ._widget_pivotui import PivotUI
11 |
12 |
13 | class PivotUIBox(VBox):
14 | """PivotUI and save/restore buttons widget"""
15 | _view_name = Unicode('PivotUIBoxView').tag(sync=True)
16 | _model_name = Unicode('PivotUIBoxModel').tag(sync=True)
17 | _view_module = Unicode('ipypivot').tag(sync=True)
18 | _model_module = Unicode('ipypivot').tag(sync=True)
19 | _view_module_version = Unicode('~0.1.1').tag(sync=True)
20 | _model_module_version = Unicode('~0.1.1').tag(sync=True)
21 |
22 | def __init__(self,
23 | df_data=None):
24 | """
25 | """
26 | self.table = PivotUI(df_data=df_data)
27 | self.buttons = self._build_buttons()
28 | super().__init__([self.buttons, self.table])
29 |
30 | def _build_buttons(self):
31 | """
32 | """
33 |
34 | self.button_save = Button(description='Save',
35 | layout=Layout(width='100px'))
36 |
37 | self.button_restore = Button(description='Restore',
38 | layout=Layout(width='100px'))
39 |
40 | self.status = widgets.Text(value='',
41 | disabled=True,
42 | layout=widgets.Layout(width='160px'))
43 |
44 | def on_save_clicked(b):
45 | self.status.value = 'Last Save: ' + self._now()
46 |
47 | self.button_save.on_click(on_save_clicked)
48 |
49 | items = [self.button_save, self.button_restore, self.status]
50 |
51 | box_layout = Layout(display='flex',
52 | justify_content='space-around',
53 | width='500px')
54 | buttons = HBox(children=items,
55 | layout=box_layout)
56 |
57 | box_layout = Layout(display='flex',
58 | justify_content='flex-start',)
59 |
60 | box = HBox(children=items, layout=box_layout)
61 |
62 | return box
63 |
64 | @staticmethod
65 | def _now():
66 | """
67 | """
68 | return dt.datetime.now().strftime('%H:%M:%S')
69 |
--------------------------------------------------------------------------------
/ipypivot/_widget_pivotui.py:
--------------------------------------------------------------------------------
1 |
2 | import ipywidgets as widgets
3 | import pandas as pd
4 |
5 | from traitlets import observe
6 | from traitlets import Unicode, Dict, List, Int
7 |
8 | from io import StringIO
9 |
10 | from ._options import PivotUI_Options
11 | from ._widget_util import shape_df
12 |
13 |
14 | # from IPython.display import display
15 |
16 |
17 | @widgets.register
18 | class PivotUI(widgets.DOMWidget):
19 | """PivotUI widget"""
20 | _view_name = Unicode('PivotUIView').tag(sync=True)
21 | _model_name = Unicode('PivotUIModel').tag(sync=True)
22 | _view_module = Unicode('ipypivot').tag(sync=True)
23 | _model_module = Unicode('ipypivot').tag(sync=True)
24 | _view_module_version = Unicode('~0.1.1').tag(sync=True)
25 | _model_module_version = Unicode('~0.1.1').tag(sync=True)
26 |
27 | _data = List([]).tag(sync=True)
28 | _options = Dict({}).tag(sync=True)
29 | _data_tsv = Unicode('Empty').tag(sync=True)
30 | _counter = Int(0)
31 |
32 | @observe('_data_tsv')
33 | def tsv_to_df(self, change):
34 | # print(change['old'])
35 | # print(change['new'])
36 | df_tsv = pd.read_csv(StringIO(self._data_tsv),
37 | sep=r'\t',
38 | lineterminator=r'\n',
39 | engine='python')
40 | self.df_export = shape_df(df_tsv,
41 | self._options)
42 | # display(self.df_export)
43 |
44 | def __init__(self,
45 | df_data=None):
46 | """
47 | """
48 | super().__init__()
49 | self.options = PivotUI_Options(self)
50 |
51 | if df_data is not None:
52 | arr = df_data.values.tolist()
53 | arr.insert(0, list(df_data.columns))
54 | self._data = arr
55 |
56 | @observe('_counter')
57 | def change_options(self, change):
58 | # print('change _counter')
59 | self._options = self.options.to_dict()
60 |
61 | @observe('_options')
62 | def change_options_dic(self, change):
63 | # print('change options')
64 | for key, value in self._options.items():
65 | if key not in ['aggregators', 'derivedAttributes', 'renderers', 'sorters', 'rendererOptions']:
66 | if key not in self.options.__dict__.keys() or getattr(self.options, key) != value:
67 | object.__setattr__(self.options, key, value)
68 |
--------------------------------------------------------------------------------
/ipypivot/api/pivot.json:
--------------------------------------------------------------------------------
1 | [{"Key ":"rows ","Type ":"array of strings ","Default value ":"[] ","Description":"array of attribute names to use as rows"},{"Key ":"cols ","Type ":"array of strings ","Default value ":"[] ","Description":"array of attribute names for use as columns"},{"Key ":"aggregator ","Type ":"function ","Default value ":"$.pivotUtilities .aggregators[\"Count\"]() ","Description":"constructor for an object which will aggregate results per cell (see documentation)"},{"Key ":"aggregatorName ","Type ":"string ","Default value ":"Count ","Description":"Name of the aggregator, used for display purposes in some renderers"},{"Key ":"renderer ","Type ":"function ","Default value ":"table() ","Description":"generates output from pivot data structure (see documentation)"},{"Key ":"rowOrder ","Type ":"string ","Default value ":"key_a_to_z ","Description":"the order in which row data is provided to the renderer, must be one of \"key_a_to_z\", \"value_a_to_z\", \"value_z_to_a\", ordering by value orders by row total"},{"Key ":"colOrder ","Type ":"string ","Default value ":"key_a_to_z ","Description":"the order in which column data is provided to the renderer, must be one of \"key_a_to_z\", \"value_a_to_z\", \"value_z_to_a\", ordering by value orders by column total"},{"Key ":"derivedAttributes ","Type ":"object of functions ","Default value ":"{} ","Description":"object to define derived attributes (see documentation)"},{"Key ":"dataClass ","Type ":"function ","Default value ":"$.pivotUtilities.PivotData ","Description":"Constructor for the data class to be built and passed to the Renderer (should be a subclass of the default)"},{"Key ":"filter ","Type ":"function ","Default value ":"function(){return true;} ","Description":"called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise"},{"Key ":"sorters ","Type ":"object or function ","Default value ":"{} ","Description":"accessed or called with an attribute name and can return a function which can be used as an argument to array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in \"natural sort\" implementation. Useful for sorting attributes like month names, see example 1 and example 2."},{"Key ":"rendererOptions ","Type ":"object ","Default value ":"{} ","Description":"object passed through to renderer as options"},{"Key ":"localeStrings ","Type ":"object ","Default value ":"en strings ","Description":"locale-specific strings for error messages (see locale parameter below)"}]
--------------------------------------------------------------------------------
/js/webpack.config.js:
--------------------------------------------------------------------------------
1 |
2 | var path = require('path');
3 | var version = require('./package.json').version;
4 |
5 | // Custom webpack rules are generally the same for all webpack bundles, hence
6 | // stored in a separate local variable.
7 | var rules = [
8 | { test: /\.css$/, use: ['style-loader', 'css-loader'] },
9 | { test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
10 | { test: /\.json$/, loader: 'json-loader' }
11 | ];
12 |
13 |
14 | module.exports = [
15 | {// Notebook extension
16 | //
17 | // This bundle only contains the part of the JavaScript that is run on
18 | // load of the notebook. This section generally only performs
19 | // some configuration for requirejs, and provides the legacy
20 | // "load_ipython_extension" function which is required for any notebook
21 | // extension.
22 | //
23 | entry: './lib/extension.js',
24 | output: {
25 | filename: 'extension.js',
26 | path: path.resolve(__dirname, '..', 'ipypivot', 'static'),
27 | libraryTarget: 'amd'
28 | }
29 | },
30 | {// Bundle for the notebook containing the custom widget views and models
31 | //
32 | // This bundle contains the implementation for the custom widget views and
33 | // custom widget.
34 | // It must be an amd module
35 | //
36 | entry: './lib/index.js',
37 | output: {
38 | filename: 'index.js',
39 | path: path.resolve(__dirname, '..', 'ipypivot', 'static'),
40 | libraryTarget: 'amd'
41 | },
42 | devtool: 'source-map',
43 | module: {
44 | rules: rules
45 | },
46 | // externals: ['@jupyter-widgets/base']
47 | externals: ['@jupyter-widgets/base', '@jupyter-widgets/controls']
48 | },
49 | {// Embeddable widget-pivot-table bundle
50 | //
51 | // This bundle is generally almost identical to the notebook bundle
52 | // containing the custom widget views and models.
53 | //
54 | // The only difference is in the configuration of the webpack public path
55 | // for the static assets.
56 | //
57 | // It will be automatically distributed by unpkg to work with the static
58 | // widget embedder.
59 | //
60 | // The target bundle is always `dist/index.js`, which is the path required
61 | // by the custom widget embedder.
62 | //
63 | entry: './lib/embed.js',
64 | output: {
65 | filename: 'index.js',
66 | path: path.resolve(__dirname, 'dist'),
67 | libraryTarget: 'amd',
68 | publicPath: 'https://unpkg.com/ipypivot@' + version + '/dist/'
69 | },
70 | devtool: 'source-map',
71 | module: {
72 | rules: rules
73 | },
74 | // externals: ['@jupyter-widgets/base']
75 | externals: ['@jupyter-widgets/base', '@jupyter-widgets/controls']
76 | }
77 | ];
78 |
--------------------------------------------------------------------------------
/js/lib/widget_pivotui_box.js:
--------------------------------------------------------------------------------
1 | "use strict";
2 |
3 | var ipywidgets = require("@jupyter-widgets/controls");
4 | var $ = require("jquery");
5 | var pivot_table = require("./pivot-table");
6 | require("./style.css");
7 |
8 | // Custom Model. Custom widgets models must at least provide default values
9 | // for model attributes, including
10 | //
11 | // - `_view_name`
12 | // - `_view_module`
13 | // - `_view_module_version`
14 | //
15 | // - `_model_name`
16 | // - `_model_module`
17 | // - `_model_module_version`
18 | //
19 | // when different from the base class.
20 |
21 | // When serialiazing the entire widget state for embedding, only values that
22 | // differ from the defaults will be specified.
23 |
24 | var PivotUIBoxModel = ipywidgets.VBoxModel.extend({
25 | defaults: $.extend(ipywidgets.VBoxModel.prototype.defaults(), {
26 | _model_name: "PivotUIBoxModel",
27 | _view_name: "PivotUIBoxView",
28 | _model_module: "ipypivot",
29 | _view_module: "ipypivot",
30 | _model_module_version: "~0.1.1",
31 | _view_module_version: "~0.1.1",
32 | })
33 | });
34 |
35 | var PivotUIBoxView = ipywidgets.VBoxView.extend({
36 | render: function() {
37 | console.log("ipypivot PivotUIBoxModel start render");
38 |
39 | window.boxview = this; // debug
40 | ipywidgets.VBoxView.prototype.render.call(this); // call default render
41 | this.childrenviews = this.children_views.views; // get children views
42 |
43 | var buttons = this.childrenviews[0];
44 | var pivot = this.childrenviews[1];
45 |
46 | var that = this; // explicit
47 |
48 | pivot.then(function(view_pivot) {
49 | that.view_pivot = view_pivot;
50 |
51 | var button_save_clicked = function() {
52 | console.log(
53 | "ipypivot PivotUIBoxModel start button_save_clicked"
54 | );
55 | // save triggers all views rendering
56 | pivot_table.save_to_model(view_pivot);
57 | };
58 |
59 | var button_restore_clicked = function() {
60 | console.log(
61 | "ipypivot PivotUIBoxModel start button_restore_cliked"
62 | );
63 | // call_pivottablejs
64 | pivot_table.call_pivottablejs(view_pivot, "pivotui", "update");
65 | };
66 |
67 | buttons.then(function(view_buttons) {
68 | view_buttons.children_views.views[0].then(function(button_save) {
69 | // add new event listener
70 | button_save.el.addEventListener("click", button_save_clicked);
71 | });
72 |
73 | view_buttons.children_views.views[1].then(function(button_restore) {
74 | // add new event listener
75 | button_restore.el.addEventListener("click", button_restore_clicked);
76 | });
77 | });
78 | });
79 | }
80 | });
81 |
82 | module.exports = {
83 | PivotUIBoxModel: PivotUIBoxModel,
84 | PivotUIBoxView: PivotUIBoxView
85 | };
86 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ipypivot
2 |
3 | [](https://mybinder.org/v2/gh/PierreMarion23/ipypivot-binder/master?filepath=demo_pivot_table.ipynb)
4 |
5 | ## 1 - Overview
6 |
7 | This is a [jupyter widget (or ipywidget)](https://ipywidgets.readthedocs.io/en/stable/) wrapping the very convenient [pivotTable.js](https://pivottable.js.org/examples/) library.
8 |
9 | It enables to display and embed a pivotTable in a Jupyter notebook in a few Python lines.
10 |
11 | ## 2 - Install
12 |
13 | From pip:
14 |
15 | ```bash
16 | $ pip install ipypivot
17 | ```
18 |
19 | From conda:
20 |
21 | ```bash
22 | $ conda install -c conda-forge ipypivot
23 | ```
24 |
25 | For more info about jupyter widgets (installation process, packaging and publishing), and also tips about the development of custom widgets, see [this tutorial repo](https://github.com/ocoudray/first-widget). All what's written there is also true for this package, just changing the name `first-widget` into `ipypivot`.
26 |
27 | ## 3 - User Guide
28 |
29 | See the [demo notebook](https://nbviewer.jupyter.org/github/PierreMarion23/ipypivot/blob/master/notebooks/demo_ipypivot.ipynb) for examples and explanations.
30 |
31 | In short:
32 | + The 2 pivotTable.js functions `pivot()` and `pivotUI()` are tranparently accessible.
33 | + The data is expected in [pandas DataFrame](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html) format.
34 | + The options are input as an option helper object (`Pivot_Options` or `PivotUI_Options`)
35 | + _Note_: the range of possible options for `pivot()` and `pivotUI()` differ - but there is overlap.
36 |
37 |
38 | Basic examples:
39 |
40 | ```python
41 | df = pd.DataFrame(data=[{'color': 'blue', 'shape': 'circle'},
42 | {'color': "red", 'shape': 'triangle'}])
43 |
44 | # pivot()
45 | p = pt.Pivot(df_data=df)
46 | opts = p.options
47 | opts.rows = ['color']
48 | opts.cols = ['shape']
49 | display(p)
50 |
51 | # pivotUI
52 | p = pt.PivotUI(df_data=df)
53 | opts = p.options
54 | opts.rows = ['color']
55 | opts.cols = ['shape']
56 | display(p)
57 | ```
58 |
59 |
60 | ## 4 - Alternative
61 |
62 | The repo branch `alt` contains an alternative widget PivotUI widget.
63 | It has the same the same features but is implemented in pure web (buttons and 'Last Save' fields).
64 | As opposed to the master branch which implements a combo of core and custom widgets.
65 | The latter is more modular and flexible. In this case it is also slightly more complex.
66 | But it may serve as an example for building a Jupyter widget from several component widgets.
67 |
68 | ## 5 - Credit
69 |
70 | This repo is the result from a collaboration between [oscar6echo](https://github.com/oscar6echo), [ocoudray](https://github.com/ocoudray), and [PierreMarion23](https://github.com/PierreMarion23).
71 |
72 | For more context, read the article [Authoring Custom Jupyter Widgets - A Hands-On Guide](https://blog.jupyter.org/authoring-custom-jupyter-widgets-2884a462e724) on the [Jupyter Blog](https://blog.jupyter.org/).
73 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 |
2 | # necessary to push to PyPI
3 | # cf. http://peterdowns.com/posts/first-time-with-pypi.html
4 | # cf. https://tom-christie.github.io/articles/pypi/
5 | # cf. https://pythonhosted.org/setuptools/setuptools.html
6 |
7 | # commands:
8 | # python setup.py sdist upload -r testpypi
9 | # python setup.py sdist upload -r pypi
10 |
11 |
12 | from distutils.util import convert_path
13 | from setuptools import setup, find_packages
14 |
15 |
16 | ##################################################
17 | module = 'ipypivot'
18 | ##################################################
19 |
20 | # get version from __meta__
21 | meta_ns = {}
22 | path = convert_path(module + '/__meta__.py')
23 | with open(path) as meta_file:
24 | exec(meta_file.read(), meta_ns)
25 |
26 |
27 | # read requirements.txt
28 | with open('requirements.txt', 'r') as f:
29 | content = f.read()
30 | li_req = content.split('\n')
31 | install_requires = [e.strip() for e in li_req if len(e)]
32 |
33 |
34 | name = module
35 | name_url = name.replace('_', '-')
36 |
37 | packages = [module]
38 | version = meta_ns['__version__']
39 | description = 'Jupyter widget (or ipywidget) wrapping the very convenient pivotTable.js library'
40 | long_description = 'See github repo README'
41 | author = 'PierreMarion23'
42 | author_email = 'pierre23.marion@free.fr'
43 | # github template
44 | url = 'https://github.com/{}/{}'.format(author,
45 | name_url)
46 | download_url = 'https://github.com/{}/{}/tarball/{}'.format(author,
47 | name_url,
48 | version)
49 | keywords = ['jupyter-widget',
50 | 'javascript',
51 | 'pivottable',
52 | ]
53 | license = 'MIT'
54 | classifiers = ['Development Status :: 4 - Beta',
55 | 'License :: OSI Approved :: MIT License',
56 | 'Programming Language :: Python :: 3.5',
57 | 'Programming Language :: Python :: 3.6'
58 | ]
59 | include_package_data = True
60 | data_files = [
61 | ('share/jupyter/nbextensions/ipypivot', [
62 | 'ipypivot/static/extension.js',
63 | 'ipypivot/static/index.js',
64 | 'ipypivot/static/index.js.map',
65 | ]),
66 | ('etc/jupyter/nbconfig/notebook.d', [
67 | 'enable_ipypivot.json'
68 | ])
69 |
70 | ]
71 | install_requires = install_requires
72 | zip_safe = False
73 |
74 |
75 | # ref https://packaging.python.org/tutorials/distributing-packages/
76 | setup(
77 | name=name,
78 | version=version,
79 | packages=packages,
80 | author=author,
81 | author_email=author_email,
82 | description=description,
83 | long_description=long_description,
84 | url=url,
85 | download_url=download_url,
86 | keywords=keywords,
87 | license=license,
88 | classifiers=classifiers,
89 | include_package_data=include_package_data,
90 | data_files=data_files,
91 | install_requires=install_requires,
92 | zip_safe=zip_safe,
93 | )
94 |
--------------------------------------------------------------------------------
/js/lib/pivot-table.css:
--------------------------------------------------------------------------------
1 |
2 | .pvtUi{
3 | color:#333
4 | }
5 | table.pvtTable{
6 | font-size:8pt;
7 | text-align:left;
8 | border-collapse:collapse
9 | }
10 | table.pvtTable tbody tr th,table.pvtTable thead tr th{
11 | background-color:#e6EEEE;
12 | border:1px solid #CDCDCD;
13 | font-size:8pt;
14 | padding:5px
15 | }
16 | table.pvtTable .pvtColLabel{
17 | text-align:center
18 | }
19 | table.pvtTable .pvtTotalLabel{
20 | text-align:right
21 | }
22 | table.pvtTable tbody tr td{
23 | color:#3D3D3D;
24 | padding:5px;
25 | background-color:#FFF;
26 | border:1px solid #CDCDCD;
27 | vertical-align:top;
28 | text-align:right
29 | }
30 | .pvtGrandTotal,.pvtTotal{
31 | font-weight:700
32 | }
33 | .pvtVals{
34 | text-align:center;
35 | white-space:nowrap
36 | }
37 | .pvtColOrder,.pvtRowOrder{
38 | cursor:pointer;
39 | width:15px;
40 | margin-left:5px;
41 | display:inline-block
42 | }
43 | .pvtAggregator{
44 | margin-bottom:5px
45 | }
46 | .pvtAxisContainer,.pvtVals{
47 | border:1px solid gray;
48 | background:#EEE;
49 | padding:5px;
50 | min-width:20px;
51 | min-height:20px
52 | }
53 | .pvtAxisContainer li{
54 | padding:8px 6px;
55 | list-style-type:none;
56 | cursor:move
57 | }
58 | .pvtAxisContainer li.pvtPlaceholder{
59 | -webkit-border-radius:5px;
60 | padding:3px 15px;
61 | -moz-border-radius:5px;
62 | border-radius:5px;
63 | border:1px dashed #aaa
64 | }
65 | .pvtAxisContainer li span.pvtAttr{
66 | -webkit-text-size-adjust:100%;
67 | background:#F3F3F3;
68 | border:1px solid #DEDEDE;
69 | padding:2px 5px;
70 | white-space:nowrap;
71 | -webkit-border-radius:5px;
72 | -moz-border-radius:5px;
73 | border-radius:5px
74 | }
75 | .pvtTriangle{
76 | cursor:pointer;
77 | color:grey
78 | }
79 | .pvtHorizList li{
80 | display:inline
81 | }
82 | .pvtVertList{
83 | vertical-align:top
84 | }
85 | .pvtFilteredAttribute{
86 | font-style:italic
87 | }
88 | .pvtFilterBox{
89 | z-index:100;
90 | width:300px;
91 | border:1px solid gray;
92 | background-color:#fff;
93 | position:absolute;
94 | text-align:center
95 | }
96 | .pvtFilterBox h4{
97 | margin:15px
98 | }
99 | .pvtFilterBox p{
100 | margin:10px auto
101 | }
102 | .pvtFilterBox label{
103 | font-weight:400
104 | }
105 | .pvtFilterBox input[type=checkbox]{
106 | margin-right:10px;
107 | margin-left:10px
108 | }
109 | .pvtFilterBox input[type=text]{
110 | width:230px
111 | }
112 | .pvtFilterBox .count{
113 | color:gray;
114 | font-weight:400;
115 | margin-left:3px
116 | }
117 | .pvtCheckContainer{
118 | text-align:left;
119 | font-size:14px;
120 | white-space:nowrap;
121 | overflow-y:scroll;
122 | width:100%;
123 | max-height:250px;
124 | border-top:1px solid #d3d3d3;
125 | border-bottom:1px solid #d3d3d3
126 | }
127 | .pvtCheckContainer p{
128 | margin:5px
129 | }
130 | .pvtRendererArea{
131 | padding:5px
132 | }
133 |
--------------------------------------------------------------------------------
/js/lib/c3.css:
--------------------------------------------------------------------------------
1 | .c3 svg{
2 | font:10px sans-serif;
3 | -webkit-tap-highlight-color:transparent
4 | }
5 | .c3 line,.c3 path{
6 | fill:none;
7 | stroke:#000
8 | }
9 | .c3 text{
10 | -webkit-user-select:none;
11 | -moz-user-select:none;
12 | user-select:none
13 | }
14 | .c3-bars path,.c3-event-rect,.c3-legend-item-tile,.c3-xgrid-focus,.c3-ygrid{
15 | shape-rendering:crispEdges
16 | }
17 | .c3-chart-arc path{
18 | stroke:#fff
19 | }
20 | .c3-chart-arc text{
21 | fill:#fff;
22 | font-size:13px
23 | }
24 | .c3-grid line{
25 | stroke:#aaa
26 | }
27 | .c3-grid text{
28 | fill:#aaa
29 | }
30 | .c3-xgrid,.c3-ygrid{
31 | stroke-dasharray:3 3
32 | }
33 | .c3-text.c3-empty{
34 | fill:gray;
35 | font-size:2em
36 | }
37 | .c3-line{
38 | stroke-width:1px
39 | }
40 | .c3-circle._expanded_{
41 | stroke-width:1px;
42 | stroke:#fff
43 | }
44 | .c3-selected-circle{
45 | fill:#fff;
46 | stroke-width:2px
47 | }
48 | .c3-bar{
49 | stroke-width:0
50 | }
51 | .c3-bar._expanded_{
52 | fill-opacity:.75
53 | }
54 | .c3-target.c3-focused{
55 | opacity:1
56 | }
57 | .c3-target.c3-focused path.c3-line,.c3-target.c3-focused path.c3-step{
58 | stroke-width:2px
59 | }
60 | .c3-target.c3-defocused{
61 | opacity:.3!important
62 | }
63 | .c3-region{
64 | fill:#4682b4;
65 | fill-opacity:.1
66 | }
67 | .c3-brush .extent{
68 | fill-opacity:.1
69 | }
70 | .c3-legend-item{
71 | font-size:12px
72 | }
73 | .c3-legend-item-hidden{
74 | opacity:.15
75 | }
76 | .c3-legend-background{
77 | opacity:.75;
78 | fill:#fff;
79 | stroke:#d3d3d3;
80 | stroke-width:1
81 | }
82 | .c3-title{
83 | font:14px sans-serif
84 | }
85 | .c3-tooltip-container{
86 | z-index:10
87 | }
88 | .c3-tooltip{
89 | border-collapse:collapse;
90 | border-spacing:0;
91 | background-color:#fff;
92 | empty-cells:show;
93 | -webkit-box-shadow:7px 7px 12px -9px #777;
94 | -moz-box-shadow:7px 7px 12px -9px #777;
95 | box-shadow:7px 7px 12px -9px #777;
96 | opacity:.9
97 | }
98 | .c3-tooltip tr{
99 | border:1px solid #CCC
100 | }
101 | .c3-tooltip th{
102 | background-color:#aaa;
103 | font-size:14px;
104 | padding:2px 5px;
105 | text-align:left;
106 | color:#FFF
107 | }
108 | .c3-tooltip td{
109 | font-size:13px;
110 | padding:3px 6px;
111 | background-color:#fff;
112 | border-left:1px dotted #999
113 | }
114 | .c3-tooltip td>span{
115 | display:inline-block;
116 | width:10px;
117 | height:10px;
118 | margin-right:6px
119 | }
120 | .c3-tooltip td.value{
121 | text-align:right
122 | }
123 | .c3-area{
124 | stroke-width:0;
125 | opacity:.2
126 | }
127 | .c3-chart-arcs-title{
128 | dominant-baseline:middle;
129 | font-size:1.3em
130 | }
131 | .c3-chart-arcs .c3-chart-arcs-background{
132 | fill:#e0e0e0;
133 | stroke:none
134 | }
135 | .c3-chart-arcs .c3-chart-arcs-gauge-unit{
136 | fill:#000;
137 | font-size:16px
138 | }
139 | .c3-chart-arcs .c3-chart-arcs-gauge-max,.c3-chart-arcs .c3-chart-arcs-gauge-min{
140 | fill:#777
141 | }
142 | .c3-chart-arc .c3-gauge-value{
143 | fill:#000
144 | }
145 |
--------------------------------------------------------------------------------
/ipypivot/_wrapper.py:
--------------------------------------------------------------------------------
1 |
2 | from IPython.display import HTML, display
3 |
4 | from ._config import NAME, TYPE, DEFAULT, DESCRIPTION
5 | from ._state import State
6 |
7 |
8 | class Wrapper(object):
9 |
10 | def __init__(self,
11 | state,
12 | path=''):
13 | self.path = path
14 | self.state = state
15 |
16 | def __getattr__(self, item):
17 | _path = item if not self.path else self.path + '.' + item
18 | for attr in self.state._OPTION:
19 | if _path == attr.get(NAME):
20 | var = Wrapper(_path)
21 | if len(dir(var)):
22 | setattr(self, item, var)
23 | # setattr(self, item, var if len(dir(var)) else '')
24 | return var
25 |
26 | def __dir__(self):
27 | _dir = []
28 | _path = self.path.split('.')
29 | if len(_path) == 1 and self.path is '':
30 | for attr in self.state._OPTION:
31 | if len(attr.get(NAME).split('.')) == 1:
32 | _dir.append(attr.get(NAME))
33 | else:
34 | for attr in self.state._OPTION:
35 | _attr_path = attr.get(NAME).split('.')
36 | if len(_path) < len(_attr_path):
37 | if _path[len(_path) - 1] == _attr_path[len(_path) - 1] \
38 | and len(_attr_path) == len(_path) + 1:
39 | _dir.append(_attr_path[len(_path)])
40 | return _dir
41 |
42 | def to_dict(self):
43 | _dic = dict(self.__dict__)
44 | _dic.pop('path')
45 | _dic.pop('_pivot')
46 |
47 | for k in list(_dic.keys()):
48 | if isinstance(_dic[k], list):
49 | for i, e in enumerate(_dic[k]):
50 | if isinstance(e, Wrapper):
51 | _dic[k][i] = _dic[k][i].to_dict()
52 | elif isinstance(e, dict):
53 | pass
54 | elif _dic[k][i] == {} or _dic[k][i] == None or isinstance(_dic[k][i], State):
55 | _dic[k].pop(i)
56 | else:
57 | if isinstance(_dic[k], Wrapper):
58 | _dic[k] = _dic[k].to_dict()
59 | elif isinstance(_dic[k], dict):
60 | pass
61 | elif _dic[k] == {} or _dic[k] == None or isinstance(_dic[k], State):
62 | _dic.pop(k)
63 |
64 | return _dic
65 |
66 | @property
67 | def __doc__(self):
68 | for attr in self.state._OPTION:
69 | if self.path == attr.get(NAME):
70 | _type = attr.get(TYPE)
71 | _default = attr.get(DEFAULT)
72 | _desc = attr.get(DESCRIPTION)
73 | break
74 |
75 | doc = "Documentation for '%s'\n\n" % self.path + \
76 | "Type\n%s\n\n" % _type + \
77 | "Default\n%s\n\n" % _default + \
78 | "Description\n%s\n\n" % _desc
79 |
80 | return doc
81 |
82 | def info(self):
83 | if self.path != '':
84 | for attr in self.state._OPTION:
85 | if self.path == attr.get(NAME):
86 | _type = attr.get(TYPE)
87 | _default = attr.get(DEFAULT)
88 | _desc = attr.get(DESCRIPTION)
89 | break
90 |
91 | doc = "
Documentation for '%s'
" % self.path + \
92 | "Type %s
" % _type + \
93 | "Default %s
" % _default + \
94 | "Description %s
" % _desc
95 |
96 | display(HTML(doc))
97 |
98 |
--------------------------------------------------------------------------------
/ipypivot/api/pivotui.tsv:
--------------------------------------------------------------------------------
1 | Key Type Default value Description
2 | rows array of strings [] attribute names to prepopulate in row area
3 | cols array of strings [] attribute names to prepopulate in cols area
4 | vals array of strings [] attribute names to prepopulate in vals area (gets passed to aggregator generating function)
5 | aggregators object of functions $.pivotUtilities.aggregators dictionary of generators for aggregation functions in dropdown (see documentation)
6 | aggregatorName string first key in aggregators aggregator to prepopulate in dropdown i.e. key to aggregators object
7 | renderers object of functions $.pivotUtilities.renderers dictionary of rendering functions (see documentation)
8 | rendererName string first key in renderers renderer to prepopulate in dropdown, i.e key to renderers object
9 | rowOrder string "key_a_to_z" the order in which row data is provided to the renderer, must be one of "key_a_to_z", "value_a_to_z", "value_z_to_a", ordering by value orders by row total
10 | colOrder string "key_a_to_z" the order in which column data is provided to the renderer, must be one of "key_a_to_z", "value_a_to_z", "value_z_to_a", ordering by value orders by column total
11 | derivedAttributes object of functions {} defines derived attributes (see documentation)
12 | dataClass function $.pivotUtilities.PivotData Constructor for the data class to be built and passed to the Renderer (should be a subclass of the default)
13 | filter function function(){return true;} called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise
14 | inclusions object of arrays of strings {} object whose keys are attribute names and values are arrays of attribute values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides exclusions below)
15 | exclusions object of arrays of strings {} object whose keys are attribute names and values are arrays of attribute values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click
16 | hiddenAttributes array of strings [] contains attribute names to omit from the UI
17 | hiddenFromAggregators array of strings [] contains attribute names to omit from the aggregator arguments dropdowns
18 | hiddenFromDragDrop array of strings [] contains attribute names to omit from the drag'n'drop portion of the UI
19 | sorters object or function {} accessed or called with an attribute name and can return a function which can be used as an argument to array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in "natural sort" implementation. Useful for sorting attributes like month names, see example 1 and example 2.
20 | onRefresh function function(){} called upon renderer refresh with an object representing the current UI settings (see example)
21 | menuLimit integer 50 maximum number of values to list in the double-click menu
22 | autoSortUnusedAttrs boolean false controls whether or not unused attributes are kept sorted in the UI
23 | unusedAttrsVertical boolean or integer 85 controls whether or not unused attributes are shown vertically instead of the default which is horizontally. true means always vertical, false means always horizontal. If set to a number (as is the default) then if the attributes' names' combined length in characters exceeds the number then the attributes will be shown vertically
24 | rendererOptions object {} passed through to renderer as options
25 | localeStrings object en strings locale-specific strings for UI display (see locale parameter below)
26 |
--------------------------------------------------------------------------------
/ipypivot/data/iris.csv:
--------------------------------------------------------------------------------
1 | Sepal.Length,Sepal.Width,Petal.Length,Petal.Width,Species
2 | 5.1,3.5,1.4,0.2,setosa
3 | 4.9,3.0,1.4,0.2,setosa
4 | 4.7,3.2,1.3,0.2,setosa
5 | 4.6,3.1,1.5,0.2,setosa
6 | 5.0,3.6,1.4,0.2,setosa
7 | 5.4,3.9,1.7,0.4,setosa
8 | 4.6,3.4,1.4,0.3,setosa
9 | 5.0,3.4,1.5,0.2,setosa
10 | 4.4,2.9,1.4,0.2,setosa
11 | 4.9,3.1,1.5,0.1,setosa
12 | 5.4,3.7,1.5,0.2,setosa
13 | 4.8,3.4,1.6,0.2,setosa
14 | 4.8,3.0,1.4,0.1,setosa
15 | 4.3,3.0,1.1,0.1,setosa
16 | 5.8,4.0,1.2,0.2,setosa
17 | 5.7,4.4,1.5,0.4,setosa
18 | 5.4,3.9,1.3,0.4,setosa
19 | 5.1,3.5,1.4,0.3,setosa
20 | 5.7,3.8,1.7,0.3,setosa
21 | 5.1,3.8,1.5,0.3,setosa
22 | 5.4,3.4,1.7,0.2,setosa
23 | 5.1,3.7,1.5,0.4,setosa
24 | 4.6,3.6,1.0,0.2,setosa
25 | 5.1,3.3,1.7,0.5,setosa
26 | 4.8,3.4,1.9,0.2,setosa
27 | 5.0,3.0,1.6,0.2,setosa
28 | 5.0,3.4,1.6,0.4,setosa
29 | 5.2,3.5,1.5,0.2,setosa
30 | 5.2,3.4,1.4,0.2,setosa
31 | 4.7,3.2,1.6,0.2,setosa
32 | 4.8,3.1,1.6,0.2,setosa
33 | 5.4,3.4,1.5,0.4,setosa
34 | 5.2,4.1,1.5,0.1,setosa
35 | 5.5,4.2,1.4,0.2,setosa
36 | 4.9,3.1,1.5,0.2,setosa
37 | 5.0,3.2,1.2,0.2,setosa
38 | 5.5,3.5,1.3,0.2,setosa
39 | 4.9,3.6,1.4,0.1,setosa
40 | 4.4,3.0,1.3,0.2,setosa
41 | 5.1,3.4,1.5,0.2,setosa
42 | 5.0,3.5,1.3,0.3,setosa
43 | 4.5,2.3,1.3,0.3,setosa
44 | 4.4,3.2,1.3,0.2,setosa
45 | 5.0,3.5,1.6,0.6,setosa
46 | 5.1,3.8,1.9,0.4,setosa
47 | 4.8,3.0,1.4,0.3,setosa
48 | 5.1,3.8,1.6,0.2,setosa
49 | 4.6,3.2,1.4,0.2,setosa
50 | 5.3,3.7,1.5,0.2,setosa
51 | 5.0,3.3,1.4,0.2,setosa
52 | 7.0,3.2,4.7,1.4,versicolor
53 | 6.4,3.2,4.5,1.5,versicolor
54 | 6.9,3.1,4.9,1.5,versicolor
55 | 5.5,2.3,4.0,1.3,versicolor
56 | 6.5,2.8,4.6,1.5,versicolor
57 | 5.7,2.8,4.5,1.3,versicolor
58 | 6.3,3.3,4.7,1.6,versicolor
59 | 4.9,2.4,3.3,1.0,versicolor
60 | 6.6,2.9,4.6,1.3,versicolor
61 | 5.2,2.7,3.9,1.4,versicolor
62 | 5.0,2.0,3.5,1.0,versicolor
63 | 5.9,3.0,4.2,1.5,versicolor
64 | 6.0,2.2,4.0,1.0,versicolor
65 | 6.1,2.9,4.7,1.4,versicolor
66 | 5.6,2.9,3.6,1.3,versicolor
67 | 6.7,3.1,4.4,1.4,versicolor
68 | 5.6,3.0,4.5,1.5,versicolor
69 | 5.8,2.7,4.1,1.0,versicolor
70 | 6.2,2.2,4.5,1.5,versicolor
71 | 5.6,2.5,3.9,1.1,versicolor
72 | 5.9,3.2,4.8,1.8,versicolor
73 | 6.1,2.8,4.0,1.3,versicolor
74 | 6.3,2.5,4.9,1.5,versicolor
75 | 6.1,2.8,4.7,1.2,versicolor
76 | 6.4,2.9,4.3,1.3,versicolor
77 | 6.6,3.0,4.4,1.4,versicolor
78 | 6.8,2.8,4.8,1.4,versicolor
79 | 6.7,3.0,5.0,1.7,versicolor
80 | 6.0,2.9,4.5,1.5,versicolor
81 | 5.7,2.6,3.5,1.0,versicolor
82 | 5.5,2.4,3.8,1.1,versicolor
83 | 5.5,2.4,3.7,1.0,versicolor
84 | 5.8,2.7,3.9,1.2,versicolor
85 | 6.0,2.7,5.1,1.6,versicolor
86 | 5.4,3.0,4.5,1.5,versicolor
87 | 6.0,3.4,4.5,1.6,versicolor
88 | 6.7,3.1,4.7,1.5,versicolor
89 | 6.3,2.3,4.4,1.3,versicolor
90 | 5.6,3.0,4.1,1.3,versicolor
91 | 5.5,2.5,4.0,1.3,versicolor
92 | 5.5,2.6,4.4,1.2,versicolor
93 | 6.1,3.0,4.6,1.4,versicolor
94 | 5.8,2.6,4.0,1.2,versicolor
95 | 5.0,2.3,3.3,1.0,versicolor
96 | 5.6,2.7,4.2,1.3,versicolor
97 | 5.7,3.0,4.2,1.2,versicolor
98 | 5.7,2.9,4.2,1.3,versicolor
99 | 6.2,2.9,4.3,1.3,versicolor
100 | 5.1,2.5,3.0,1.1,versicolor
101 | 5.7,2.8,4.1,1.3,versicolor
102 | 6.3,3.3,6.0,2.5,virginica
103 | 5.8,2.7,5.1,1.9,virginica
104 | 7.1,3.0,5.9,2.1,virginica
105 | 6.3,2.9,5.6,1.8,virginica
106 | 6.5,3.0,5.8,2.2,virginica
107 | 7.6,3.0,6.6,2.1,virginica
108 | 4.9,2.5,4.5,1.7,virginica
109 | 7.3,2.9,6.3,1.8,virginica
110 | 6.7,2.5,5.8,1.8,virginica
111 | 7.2,3.6,6.1,2.5,virginica
112 | 6.5,3.2,5.1,2.0,virginica
113 | 6.4,2.7,5.3,1.9,virginica
114 | 6.8,3.0,5.5,2.1,virginica
115 | 5.7,2.5,5.0,2.0,virginica
116 | 5.8,2.8,5.1,2.4,virginica
117 | 6.4,3.2,5.3,2.3,virginica
118 | 6.5,3.0,5.5,1.8,virginica
119 | 7.7,3.8,6.7,2.2,virginica
120 | 7.7,2.6,6.9,2.3,virginica
121 | 6.0,2.2,5.0,1.5,virginica
122 | 6.9,3.2,5.7,2.3,virginica
123 | 5.6,2.8,4.9,2.0,virginica
124 | 7.7,2.8,6.7,2.0,virginica
125 | 6.3,2.7,4.9,1.8,virginica
126 | 6.7,3.3,5.7,2.1,virginica
127 | 7.2,3.2,6.0,1.8,virginica
128 | 6.2,2.8,4.8,1.8,virginica
129 | 6.1,3.0,4.9,1.8,virginica
130 | 6.4,2.8,5.6,2.1,virginica
131 | 7.2,3.0,5.8,1.6,virginica
132 | 7.4,2.8,6.1,1.9,virginica
133 | 7.9,3.8,6.4,2.0,virginica
134 | 6.4,2.8,5.6,2.2,virginica
135 | 6.3,2.8,5.1,1.5,virginica
136 | 6.1,2.6,5.6,1.4,virginica
137 | 7.7,3.0,6.1,2.3,virginica
138 | 6.3,3.4,5.6,2.4,virginica
139 | 6.4,3.1,5.5,1.8,virginica
140 | 6.0,3.0,4.8,1.8,virginica
141 | 6.9,3.1,5.4,2.1,virginica
142 | 6.7,3.1,5.6,2.4,virginica
143 | 6.9,3.1,5.1,2.3,virginica
144 | 5.8,2.7,5.1,1.9,virginica
145 | 6.8,3.2,5.9,2.3,virginica
146 | 6.7,3.3,5.7,2.5,virginica
147 | 6.7,3.0,5.2,2.3,virginica
148 | 6.3,2.5,5.0,1.9,virginica
149 | 6.5,3.0,5.2,2.0,virginica
150 | 6.2,3.4,5.4,2.3,virginica
151 | 5.9,3.0,5.1,1.8,virginica
152 |
--------------------------------------------------------------------------------
/ipypivot/api/pivotui.json:
--------------------------------------------------------------------------------
1 | [{"Key ":"rows ","Type ":"array of strings ","Default value ":"[] ","Description":"attribute names to prepopulate in row area"},{"Key ":"cols ","Type ":"array of strings ","Default value ":"[] ","Description":"attribute names to prepopulate in cols area"},{"Key ":"vals ","Type ":"array of strings ","Default value ":"[] ","Description":"attribute names to prepopulate in vals area (gets passed to aggregator generating function)"},{"Key ":"aggregators ","Type ":"object of functions ","Default value ":"$.pivotUtilities.aggregators ","Description":"dictionary of generators for aggregation functions in dropdown (see documentation)"},{"Key ":"aggregatorName ","Type ":"string ","Default value ":"first key in aggregators ","Description":"aggregator to prepopulate in dropdown i.e. key to aggregators object"},{"Key ":"renderers ","Type ":"object of functions ","Default value ":"$.pivotUtilities.renderers ","Description":"dictionary of rendering functions (see documentation)"},{"Key ":"rendererName ","Type ":"string ","Default value ":"first key in renderers ","Description":"renderer to prepopulate in dropdown, i.e key to renderers object"},{"Key ":"rowOrder ","Type ":"string ","Default value ":"key_a_to_z ","Description":"the order in which row data is provided to the renderer, must be one of \"key_a_to_z\", \"value_a_to_z\", \"value_z_to_a\", ordering by value orders by row total"},{"Key ":"colOrder ","Type ":"string ","Default value ":"key_a_to_z ","Description":"the order in which column data is provided to the renderer, must be one of \"key_a_to_z\", \"value_a_to_z\", \"value_z_to_a\", ordering by value orders by column total"},{"Key ":"derivedAttributes ","Type ":"object of functions ","Default value ":"{} ","Description":"defines derived attributes (see documentation)"},{"Key ":"dataClass ","Type ":"function ","Default value ":"$.pivotUtilities.PivotData ","Description":"Constructor for the data class to be built and passed to the Renderer (should be a subclass of the default)"},{"Key ":"filter ","Type ":"function ","Default value ":"function(){return true;} ","Description":"called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise"},{"Key ":"inclusions ","Type ":"object of arrays of strings ","Default value ":"{} ","Description":"object whose keys are attribute names and values are arrays of attribute values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides exclusions below)"},{"Key ":"exclusions ","Type ":"object of arrays of strings ","Default value ":"{} ","Description":"object whose keys are attribute names and values are arrays of attribute values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click"},{"Key ":"hiddenAttributes ","Type ":"array of strings ","Default value ":"[] ","Description":"contains attribute names to omit from the UI"},{"Key ":"hiddenFromAggregators ","Type ":"array of strings ","Default value ":"[] ","Description":"contains attribute names to omit from the aggregator arguments dropdowns"},{"Key ":"hiddenFromDragDrop ","Type ":"array of strings ","Default value ":"[] ","Description":"contains attribute names to omit from the drag'n'drop portion of the UI"},{"Key ":"sorters ","Type ":"object or function ","Default value ":"{} ","Description":"accessed or called with an attribute name and can return a function which can be used as an argument to array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in \"natural sort\" implementation. Useful for sorting attributes like month names, see example 1 and example 2."},{"Key ":"onRefresh ","Type ":"function ","Default value ":"function(){} ","Description":"called upon renderer refresh with an object representing the current UI settings (see example)"},{"Key ":"menuLimit ","Type ":"integer ","Default value ":"50 ","Description":"maximum number of values to list in the double-click menu"},{"Key ":"autoSortUnusedAttrs ","Type ":"boolean ","Default value ":"false ","Description":"controls whether or not unused attributes are kept sorted in the UI"},{"Key ":"unusedAttrsVertical ","Type ":"boolean or integer ","Default value ":"85 ","Description":"controls whether or not unused attributes are shown vertically instead of the default which is horizontally. true means always vertical, false means always horizontal. If set to a number (as is the default) then if the attributes' names' combined length in characters exceeds the number then the attributes will be shown vertically"},{"Key ":"rendererOptions ","Type ":"object ","Default value ":"{} ","Description":"passed through to renderer as options"},{"Key ":"localeStrings ","Type ":"object ","Default value ":"en strings ","Description":"locale-specific strings for UI display (see locale parameter below)"}]
--------------------------------------------------------------------------------
/js/lib/pivot-table.js:
--------------------------------------------------------------------------------
1 |
2 | 'use script';
3 |
4 | var $ = require('jquery');
5 | require('jquery-ui-bundle');
6 | require('pivottable');
7 | require('pivottable/dist/export_renderers.min.js');
8 | require('pivottable/dist/c3_renderers.min.js');
9 | require('pivottable/dist/d3_renderers.min.js');
10 |
11 | require('./pivot-table.css');
12 | require('./style.css');
13 | require('./c3.css');
14 |
15 | var util = require('./util');
16 |
17 |
18 | var createPivot = function (that) {
19 | console.log('ipypivot start createPivot');
20 |
21 | // create elmt
22 | var divElmt = document.createElement('div');
23 | divElmt.setAttribute('width', '100%');
24 |
25 | // append elmt to dom
26 | that.el.appendChild(divElmt);
27 |
28 | // set class
29 | that.el.setAttribute('class', 'jupyter-widget pivot-table');
30 |
31 | // attach to view
32 | that.tableElmt = divElmt;
33 |
34 | // set mode='pivot' to indicate origin
35 | this.call_pivottablejs(that, 'pivot', 'create');
36 |
37 | console.log('end createPivot');
38 | };
39 |
40 | var createPivotUI = function (that) {
41 | console.log('ipypivot start createPivotUI');
42 |
43 | // create elmt
44 | var divElmt = document.createElement('div');
45 | divElmt.setAttribute('width', '100%');
46 |
47 | // append elmt to dom
48 | that.el.appendChild(divElmt);
49 |
50 | // set class
51 | that.el.setAttribute('class', 'jupyter-widget pivotui-table');
52 |
53 | // attach to view
54 | that.tableElmt = divElmt;
55 |
56 | // set mode='pivotui' to indicate origin
57 | this.call_pivottablejs(that, 'pivotui', 'create');
58 |
59 | // add delay - else random failures - unknown race condition...
60 | var here = this;
61 | setTimeout(function () {
62 | here.save_to_model(that);
63 | }, 10);
64 |
65 | console.log('end createPivotUI');
66 | };
67 |
68 |
69 | var call_pivottablejs = function (that, mode) {
70 | // mode = 'pivot' - call from createPivot
71 | // mode = 'pivotui' - call from createPivotUI
72 |
73 | console.log('ipypivot PivotUIModel start call_pivottablejs');
74 |
75 | // get data from model
76 | let data = that.model.get('_data');
77 |
78 | // get options
79 | let options = that.model.get('_options');
80 | options = util.JSONPivotTable.parse(JSON.stringify(options));
81 |
82 | // copy dic
83 | let options_new = $.extend({}, options);
84 |
85 | // if no renderer present add them
86 | if (!options_new['renderers']) {
87 | console.log('add renderers');
88 | var renderers = $.extend({},
89 | $.pivotUtilities.renderers,
90 | $.pivotUtilities.c3_renderers,
91 | $.pivotUtilities.d3_renderers
92 | );
93 | // renderers = $.extend(renderers, $.pivotUtilities.export_renderers);
94 | options_new['renderers'] = renderers;
95 | }
96 | // console.log(options_new);
97 |
98 | // actual pivottable.js call
99 | if (mode == 'pivot') {
100 | console.log('call pivot');
101 | $(that.tableElmt).pivot(data, options_new);
102 | }
103 | if (mode == 'pivotui') {
104 | console.log('call pivotui');
105 | $(that.tableElmt).pivotUI(data, options_new, true);
106 | }
107 |
108 | console.log('end call_pivottablejs');
109 |
110 | // debug
111 | window.that = that;
112 | window.$ = $;
113 | window.data = data;
114 |
115 | };
116 |
117 | var save_to_model = function (that) {
118 |
119 | console.log('ipypivot start save_to_model');
120 |
121 | // get data from model
122 | let data = that.model.get('_data');
123 |
124 | // deepcopy current pivotUI options
125 | let optionsExport = $.extend({}, $(that.tableElmt).data('pivotUIOptions'));
126 | // console.log(optionsExport);
127 |
128 | // add only TSV export renderer
129 | optionsExport['renderers'] = $.pivotUtilities.export_renderers;
130 | optionsExport['rendererName'] = 'TSV Export';
131 |
132 | // create new elemt - which is never added to the dom
133 | var tempDivElmt = document.createElement('div');
134 |
135 | // actual pivottable.js call - as a promise to trigger post processing
136 | var createTsvTable = Promise.resolve($(tempDivElmt).pivotUI(data, optionsExport).promise());
137 |
138 | // action promise
139 | createTsvTable.then(function () {
140 | // post processing
141 | console.log('start save_to_model callback');
142 |
143 | // DESPITE PROMISE (!) add delay - else random failures - unknown race condition...
144 | setTimeout(function () {
145 |
146 | // extract tsv string
147 | // let data_tsv = tempDivElmt.children[0].children[2].children[1].children[0].innerHTML;
148 | let data_tsv = $(tempDivElmt).find('.pvtRendererArea')[0].children[0].innerHTML;
149 |
150 | // console.log('data_tsv');
151 | // console.log(data_tsv);
152 |
153 | // actual pivottable.js call to collect current options
154 | let options = $(that.tableElmt).data('pivotUIOptions');
155 | // console.log(options);
156 |
157 | // merge current options with old options in order to replace true functions by their strings
158 | delete options['aggregators'];
159 | delete options['renderers'];
160 | delete options['sorters'];
161 | delete options['derivedAttributes'];
162 | delete options['rendererOptions'];
163 |
164 | let old_options = that.model.get('_options');
165 | options = $.extend({}, old_options, options);
166 | // console.log(options);
167 |
168 | console.log('update model');
169 | that.model.set({
170 | '_data_tsv': data_tsv,
171 | '_options': options
172 | });
173 |
174 | // that.model.save_changes();
175 | that.touch();
176 |
177 | console.log('end save_to_model callback');
178 |
179 | // debug
180 | window.data_tsv = data_tsv;
181 |
182 | }, 100);
183 |
184 | });
185 |
186 | console.log('end save_to_model');
187 |
188 | // debug
189 | window.tempDivElmt = tempDivElmt;
190 | window.createTsvTable = createTsvTable;
191 |
192 | };
193 |
194 |
195 | var pivot_table = {
196 | createPivot: createPivot,
197 | createPivotUI: createPivotUI,
198 | call_pivottablejs: call_pivottablejs,
199 | save_to_model: save_to_model,
200 | };
201 |
202 | module.exports = pivot_table;
203 |
204 |
--------------------------------------------------------------------------------
/ipypivot/data/create_tips_csv.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 2,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import numpy as np\n",
10 | "import pandas as pd"
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": 3,
16 | "metadata": {},
17 | "outputs": [
18 | {
19 | "name": "stdout",
20 | "output_type": "stream",
21 | "text": [
22 | "\n",
23 | "RangeIndex: 244 entries, 0 to 243\n",
24 | "Data columns (total 8 columns):\n",
25 | "row 244 non-null int64\n",
26 | "total_bill 244 non-null float64\n",
27 | "tip 244 non-null float64\n",
28 | "sex 244 non-null object\n",
29 | "smoker 244 non-null object\n",
30 | "day 244 non-null object\n",
31 | "time 244 non-null object\n",
32 | "size 244 non-null int64\n",
33 | "dtypes: float64(2), int64(2), object(4)\n",
34 | "memory usage: 15.3+ KB\n"
35 | ]
36 | }
37 | ],
38 | "source": [
39 | "df = pd.read_json('tips.json')\n",
40 | "h = df.iloc[0].tolist()\n",
41 | "df = df[1:]\n",
42 | "df.columns = h\n",
43 | "df = df.reset_index(drop=True)\n",
44 | "df['row'] = df['row'].astype(np.int)\n",
45 | "df['total_bill'] = df['total_bill'].astype(np.float)\n",
46 | "df['tip'] = np.round(df['tip'].astype(np.float), 2)\n",
47 | "df['size'] = df['size'].astype(np.int)\n",
48 | "\n",
49 | "df.info()\n",
50 | "df.to_csv('tips.csv', index=None)"
51 | ]
52 | },
53 | {
54 | "cell_type": "code",
55 | "execution_count": 4,
56 | "metadata": {},
57 | "outputs": [
58 | {
59 | "data": {
60 | "text/plain": [
61 | "row 2\n",
62 | "total_bill 10.34\n",
63 | "tip 1.66\n",
64 | "sex Male\n",
65 | "smoker No\n",
66 | "day Sun\n",
67 | "time Dinner\n",
68 | "size 3\n",
69 | "Name: 1, dtype: object"
70 | ]
71 | },
72 | "execution_count": 4,
73 | "metadata": {},
74 | "output_type": "execute_result"
75 | }
76 | ],
77 | "source": [
78 | "df.iloc[1]"
79 | ]
80 | },
81 | {
82 | "cell_type": "code",
83 | "execution_count": 23,
84 | "metadata": {},
85 | "outputs": [
86 | {
87 | "name": "stdout",
88 | "output_type": "stream",
89 | "text": [
90 | "\n",
91 | "RangeIndex: 244 entries, 0 to 243\n",
92 | "Data columns (total 8 columns):\n",
93 | "row 244 non-null int64\n",
94 | "total_bill 244 non-null float64\n",
95 | "tip 244 non-null float64\n",
96 | "sex 244 non-null object\n",
97 | "smoker 244 non-null object\n",
98 | "day 244 non-null object\n",
99 | "time 244 non-null object\n",
100 | "size 244 non-null int64\n",
101 | "dtypes: float64(2), int64(2), object(4)\n",
102 | "memory usage: 15.3+ KB\n"
103 | ]
104 | },
105 | {
106 | "data": {
107 | "text/html": [
108 | "\n",
109 | "\n",
122 | "
\n",
123 | " \n",
124 | " \n",
125 | " | \n",
126 | " row | \n",
127 | " total_bill | \n",
128 | " tip | \n",
129 | " sex | \n",
130 | " smoker | \n",
131 | " day | \n",
132 | " time | \n",
133 | " size | \n",
134 | "
\n",
135 | " \n",
136 | " \n",
137 | " \n",
138 | " | 0 | \n",
139 | " 1 | \n",
140 | " 16.99 | \n",
141 | " 1.01 | \n",
142 | " Female | \n",
143 | " No | \n",
144 | " Sun | \n",
145 | " Dinner | \n",
146 | " 2 | \n",
147 | "
\n",
148 | " \n",
149 | " | 1 | \n",
150 | " 2 | \n",
151 | " 10.34 | \n",
152 | " 1.66 | \n",
153 | " Male | \n",
154 | " No | \n",
155 | " Sun | \n",
156 | " Dinner | \n",
157 | " 3 | \n",
158 | "
\n",
159 | " \n",
160 | " | 2 | \n",
161 | " 3 | \n",
162 | " 21.01 | \n",
163 | " 3.50 | \n",
164 | " Male | \n",
165 | " No | \n",
166 | " Sun | \n",
167 | " Dinner | \n",
168 | " 3 | \n",
169 | "
\n",
170 | " \n",
171 | " | 3 | \n",
172 | " 4 | \n",
173 | " 23.68 | \n",
174 | " 3.31 | \n",
175 | " Male | \n",
176 | " No | \n",
177 | " Sun | \n",
178 | " Dinner | \n",
179 | " 2 | \n",
180 | "
\n",
181 | " \n",
182 | " | 4 | \n",
183 | " 5 | \n",
184 | " 24.59 | \n",
185 | " 3.61 | \n",
186 | " Female | \n",
187 | " No | \n",
188 | " Sun | \n",
189 | " Dinner | \n",
190 | " 4 | \n",
191 | "
\n",
192 | " \n",
193 | "
\n",
194 | "
"
195 | ],
196 | "text/plain": [
197 | " row total_bill tip sex smoker day time size\n",
198 | "0 1 16.99 1.01 Female No Sun Dinner 2\n",
199 | "1 2 10.34 1.66 Male No Sun Dinner 3\n",
200 | "2 3 21.01 3.50 Male No Sun Dinner 3\n",
201 | "3 4 23.68 3.31 Male No Sun Dinner 2\n",
202 | "4 5 24.59 3.61 Female No Sun Dinner 4"
203 | ]
204 | },
205 | "execution_count": 23,
206 | "metadata": {},
207 | "output_type": "execute_result"
208 | }
209 | ],
210 | "source": [
211 | "df2 = pd.read_csv('tips.csv')\n",
212 | "df2.info()\n",
213 | "df2.head()"
214 | ]
215 | },
216 | {
217 | "cell_type": "code",
218 | "execution_count": 22,
219 | "metadata": {},
220 | "outputs": [
221 | {
222 | "data": {
223 | "text/plain": [
224 | "[['row', 'total_bill', 'tip', 'sex', 'smoker', 'day', 'time', 'size'],\n",
225 | " [1, 16.99, 1.01, 'Female', 'No', 'Sun', 'Dinner', 2],\n",
226 | " [2, 10.34, 1.66, 'Male', 'No', 'Sun', 'Dinner', 3],\n",
227 | " [3, 21.01, 3.5, 'Male', 'No', 'Sun', 'Dinner', 3]]"
228 | ]
229 | },
230 | "execution_count": 22,
231 | "metadata": {},
232 | "output_type": "execute_result"
233 | }
234 | ],
235 | "source": [
236 | "dft = df2[:3]\n",
237 | "\n",
238 | "arr = dft.values.tolist()\n",
239 | "arr.insert(0, list(dft.columns))\n",
240 | "arr\n"
241 | ]
242 | },
243 | {
244 | "cell_type": "code",
245 | "execution_count": null,
246 | "metadata": {},
247 | "outputs": [],
248 | "source": []
249 | }
250 | ],
251 | "metadata": {
252 | "kernelspec": {
253 | "display_name": "Python 3",
254 | "language": "python",
255 | "name": "python3"
256 | },
257 | "language_info": {
258 | "codemirror_mode": {
259 | "name": "ipython",
260 | "version": 3
261 | },
262 | "file_extension": ".py",
263 | "mimetype": "text/x-python",
264 | "name": "python",
265 | "nbconvert_exporter": "python",
266 | "pygments_lexer": "ipython3",
267 | "version": "3.6.1"
268 | }
269 | },
270 | "nbformat": 4,
271 | "nbformat_minor": 2
272 | }
273 |
--------------------------------------------------------------------------------
/ipypivot/data/tips.csv:
--------------------------------------------------------------------------------
1 | row,total_bill,tip,sex,smoker,day,time,size
2 | 1,16.99,1.01,Female,No,Sun,Dinner,2
3 | 2,10.34,1.66,Male,No,Sun,Dinner,3
4 | 3,21.01,3.5,Male,No,Sun,Dinner,3
5 | 4,23.68,3.31,Male,No,Sun,Dinner,2
6 | 5,24.59,3.61,Female,No,Sun,Dinner,4
7 | 6,25.29,4.71,Male,No,Sun,Dinner,4
8 | 7,8.77,2.0,Male,No,Sun,Dinner,2
9 | 8,26.88,3.12,Male,No,Sun,Dinner,4
10 | 9,15.04,1.96,Male,No,Sun,Dinner,2
11 | 10,14.78,3.23,Male,No,Sun,Dinner,2
12 | 11,10.27,1.71,Male,No,Sun,Dinner,2
13 | 12,35.26,5.0,Female,No,Sun,Dinner,4
14 | 13,15.42,1.57,Male,No,Sun,Dinner,2
15 | 14,18.43,3.0,Male,No,Sun,Dinner,4
16 | 15,14.83,3.02,Female,No,Sun,Dinner,2
17 | 16,21.58,3.92,Male,No,Sun,Dinner,2
18 | 17,10.33,1.67,Female,No,Sun,Dinner,3
19 | 18,16.29,3.71,Male,No,Sun,Dinner,3
20 | 19,16.97,3.5,Female,No,Sun,Dinner,3
21 | 20,20.65,3.35,Male,No,Sat,Dinner,3
22 | 21,17.92,4.08,Male,No,Sat,Dinner,2
23 | 22,20.29,2.75,Female,No,Sat,Dinner,2
24 | 23,15.77,2.23,Female,No,Sat,Dinner,2
25 | 24,39.42,7.58,Male,No,Sat,Dinner,4
26 | 25,19.82,3.18,Male,No,Sat,Dinner,2
27 | 26,17.81,2.34,Male,No,Sat,Dinner,4
28 | 27,13.37,2.0,Male,No,Sat,Dinner,2
29 | 28,12.69,2.0,Male,No,Sat,Dinner,2
30 | 29,21.7,4.3,Male,No,Sat,Dinner,2
31 | 30,19.65,3.0,Female,No,Sat,Dinner,2
32 | 31,9.55,1.45,Male,No,Sat,Dinner,2
33 | 32,18.35,2.5,Male,No,Sat,Dinner,4
34 | 33,15.06,3.0,Female,No,Sat,Dinner,2
35 | 34,20.69,2.45,Female,No,Sat,Dinner,4
36 | 35,17.78,3.27,Male,No,Sat,Dinner,2
37 | 36,24.06,3.6,Male,No,Sat,Dinner,3
38 | 37,16.31,2.0,Male,No,Sat,Dinner,3
39 | 38,16.93,3.07,Female,No,Sat,Dinner,3
40 | 39,18.69,2.31,Male,No,Sat,Dinner,3
41 | 40,31.27,5.0,Male,No,Sat,Dinner,3
42 | 41,16.04,2.24,Male,No,Sat,Dinner,3
43 | 42,17.46,2.54,Male,No,Sun,Dinner,2
44 | 43,13.94,3.06,Male,No,Sun,Dinner,2
45 | 44,9.68,1.32,Male,No,Sun,Dinner,2
46 | 45,30.4,5.6,Male,No,Sun,Dinner,4
47 | 46,18.29,3.0,Male,No,Sun,Dinner,2
48 | 47,22.23,5.0,Male,No,Sun,Dinner,2
49 | 48,32.4,6.0,Male,No,Sun,Dinner,4
50 | 49,28.55,2.05,Male,No,Sun,Dinner,3
51 | 50,18.04,3.0,Male,No,Sun,Dinner,2
52 | 51,12.54,2.5,Male,No,Sun,Dinner,2
53 | 52,10.29,2.6,Female,No,Sun,Dinner,2
54 | 53,34.81,5.2,Female,No,Sun,Dinner,4
55 | 54,9.94,1.56,Male,No,Sun,Dinner,2
56 | 55,25.56,4.34,Male,No,Sun,Dinner,4
57 | 56,19.49,3.51,Male,No,Sun,Dinner,2
58 | 57,38.01,3.0,Male,Yes,Sat,Dinner,4
59 | 58,26.41,1.5,Female,No,Sat,Dinner,2
60 | 59,11.24,1.76,Male,Yes,Sat,Dinner,2
61 | 60,48.27,6.73,Male,No,Sat,Dinner,4
62 | 61,20.29,3.21,Male,Yes,Sat,Dinner,2
63 | 62,13.81,2.0,Male,Yes,Sat,Dinner,2
64 | 63,11.02,1.98,Male,Yes,Sat,Dinner,2
65 | 64,18.29,3.76,Male,Yes,Sat,Dinner,4
66 | 65,17.59,2.64,Male,No,Sat,Dinner,3
67 | 66,20.08,3.15,Male,No,Sat,Dinner,3
68 | 67,16.45,2.47,Female,No,Sat,Dinner,2
69 | 68,3.07,1.0,Female,Yes,Sat,Dinner,1
70 | 69,20.23,2.01,Male,No,Sat,Dinner,2
71 | 70,15.01,2.09,Male,Yes,Sat,Dinner,2
72 | 71,12.02,1.97,Male,No,Sat,Dinner,2
73 | 72,17.07,3.0,Female,No,Sat,Dinner,3
74 | 73,26.86,3.14,Female,Yes,Sat,Dinner,2
75 | 74,25.28,5.0,Female,Yes,Sat,Dinner,2
76 | 75,14.73,2.2,Female,No,Sat,Dinner,2
77 | 76,10.51,1.25,Male,No,Sat,Dinner,2
78 | 77,17.92,3.08,Male,Yes,Sat,Dinner,2
79 | 78,27.2,4.0,Male,No,Thur,Lunch,4
80 | 79,22.76,3.0,Male,No,Thur,Lunch,2
81 | 80,17.29,2.71,Male,No,Thur,Lunch,2
82 | 81,19.44,3.0,Male,Yes,Thur,Lunch,2
83 | 82,16.66,3.4,Male,No,Thur,Lunch,2
84 | 83,10.07,1.83,Female,No,Thur,Lunch,1
85 | 84,32.68,5.0,Male,Yes,Thur,Lunch,2
86 | 85,15.98,2.03,Male,No,Thur,Lunch,2
87 | 86,34.83,5.17,Female,No,Thur,Lunch,4
88 | 87,13.03,2.0,Male,No,Thur,Lunch,2
89 | 88,18.28,4.0,Male,No,Thur,Lunch,2
90 | 89,24.71,5.85,Male,No,Thur,Lunch,2
91 | 90,21.16,3.0,Male,No,Thur,Lunch,2
92 | 91,28.97,3.0,Male,Yes,Fri,Dinner,2
93 | 92,22.49,3.5,Male,No,Fri,Dinner,2
94 | 93,5.75,1.0,Female,Yes,Fri,Dinner,2
95 | 94,16.32,4.3,Female,Yes,Fri,Dinner,2
96 | 95,22.75,3.25,Female,No,Fri,Dinner,2
97 | 96,40.17,4.73,Male,Yes,Fri,Dinner,4
98 | 97,27.28,4.0,Male,Yes,Fri,Dinner,2
99 | 98,12.03,1.5,Male,Yes,Fri,Dinner,2
100 | 99,21.01,3.0,Male,Yes,Fri,Dinner,2
101 | 100,12.46,1.5,Male,No,Fri,Dinner,2
102 | 101,11.35,2.5,Female,Yes,Fri,Dinner,2
103 | 102,15.38,3.0,Female,Yes,Fri,Dinner,2
104 | 103,44.3,2.5,Female,Yes,Sat,Dinner,3
105 | 104,22.42,3.48,Female,Yes,Sat,Dinner,2
106 | 105,20.92,4.08,Female,No,Sat,Dinner,2
107 | 106,15.36,1.64,Male,Yes,Sat,Dinner,2
108 | 107,20.49,4.06,Male,Yes,Sat,Dinner,2
109 | 108,25.21,4.29,Male,Yes,Sat,Dinner,2
110 | 109,18.24,3.76,Male,No,Sat,Dinner,2
111 | 110,14.31,4.0,Female,Yes,Sat,Dinner,2
112 | 111,14.0,3.0,Male,No,Sat,Dinner,2
113 | 112,7.25,1.0,Female,No,Sat,Dinner,1
114 | 113,38.07,4.0,Male,No,Sun,Dinner,3
115 | 114,23.95,2.55,Male,No,Sun,Dinner,2
116 | 115,25.71,4.0,Female,No,Sun,Dinner,3
117 | 116,17.31,3.5,Female,No,Sun,Dinner,2
118 | 117,29.93,5.07,Male,No,Sun,Dinner,4
119 | 118,10.65,1.5,Female,No,Thur,Lunch,2
120 | 119,12.43,1.8,Female,No,Thur,Lunch,2
121 | 120,24.08,2.92,Female,No,Thur,Lunch,4
122 | 121,11.69,2.31,Male,No,Thur,Lunch,2
123 | 122,13.42,1.68,Female,No,Thur,Lunch,2
124 | 123,14.26,2.5,Male,No,Thur,Lunch,2
125 | 124,15.95,2.0,Male,No,Thur,Lunch,2
126 | 125,12.48,2.52,Female,No,Thur,Lunch,2
127 | 126,29.8,4.2,Female,No,Thur,Lunch,6
128 | 127,8.52,1.48,Male,No,Thur,Lunch,2
129 | 128,14.52,2.0,Female,No,Thur,Lunch,2
130 | 129,11.38,2.0,Female,No,Thur,Lunch,2
131 | 130,22.82,2.18,Male,No,Thur,Lunch,3
132 | 131,19.08,1.5,Male,No,Thur,Lunch,2
133 | 132,20.27,2.83,Female,No,Thur,Lunch,2
134 | 133,11.17,1.5,Female,No,Thur,Lunch,2
135 | 134,12.26,2.0,Female,No,Thur,Lunch,2
136 | 135,18.26,3.25,Female,No,Thur,Lunch,2
137 | 136,8.51,1.25,Female,No,Thur,Lunch,2
138 | 137,10.33,2.0,Female,No,Thur,Lunch,2
139 | 138,14.15,2.0,Female,No,Thur,Lunch,2
140 | 139,16.0,2.0,Male,Yes,Thur,Lunch,2
141 | 140,13.16,2.75,Female,No,Thur,Lunch,2
142 | 141,17.47,3.5,Female,No,Thur,Lunch,2
143 | 142,34.3,6.7,Male,No,Thur,Lunch,6
144 | 143,41.19,5.0,Male,No,Thur,Lunch,5
145 | 144,27.05,5.0,Female,No,Thur,Lunch,6
146 | 145,16.43,2.3,Female,No,Thur,Lunch,2
147 | 146,8.35,1.5,Female,No,Thur,Lunch,2
148 | 147,18.64,1.36,Female,No,Thur,Lunch,3
149 | 148,11.87,1.63,Female,No,Thur,Lunch,2
150 | 149,9.78,1.73,Male,No,Thur,Lunch,2
151 | 150,7.51,2.0,Male,No,Thur,Lunch,2
152 | 151,14.07,2.5,Male,No,Sun,Dinner,2
153 | 152,13.13,2.0,Male,No,Sun,Dinner,2
154 | 153,17.26,2.74,Male,No,Sun,Dinner,3
155 | 154,24.55,2.0,Male,No,Sun,Dinner,4
156 | 155,19.77,2.0,Male,No,Sun,Dinner,4
157 | 156,29.85,5.14,Female,No,Sun,Dinner,5
158 | 157,48.17,5.0,Male,No,Sun,Dinner,6
159 | 158,25.0,3.75,Female,No,Sun,Dinner,4
160 | 159,13.39,2.61,Female,No,Sun,Dinner,2
161 | 160,16.49,2.0,Male,No,Sun,Dinner,4
162 | 161,21.5,3.5,Male,No,Sun,Dinner,4
163 | 162,12.66,2.5,Male,No,Sun,Dinner,2
164 | 163,16.21,2.0,Female,No,Sun,Dinner,3
165 | 164,13.81,2.0,Male,No,Sun,Dinner,2
166 | 165,17.51,3.0,Female,Yes,Sun,Dinner,2
167 | 166,24.52,3.48,Male,No,Sun,Dinner,3
168 | 167,20.76,2.24,Male,No,Sun,Dinner,2
169 | 168,31.71,4.5,Male,No,Sun,Dinner,4
170 | 169,10.59,1.61,Female,Yes,Sat,Dinner,2
171 | 170,10.63,2.0,Female,Yes,Sat,Dinner,2
172 | 171,50.81,10.0,Male,Yes,Sat,Dinner,3
173 | 172,15.81,3.16,Male,Yes,Sat,Dinner,2
174 | 173,7.25,5.15,Male,Yes,Sun,Dinner,2
175 | 174,31.85,3.18,Male,Yes,Sun,Dinner,2
176 | 175,16.82,4.0,Male,Yes,Sun,Dinner,2
177 | 176,32.9,3.11,Male,Yes,Sun,Dinner,2
178 | 177,17.89,2.0,Male,Yes,Sun,Dinner,2
179 | 178,14.48,2.0,Male,Yes,Sun,Dinner,2
180 | 179,9.6,4.0,Female,Yes,Sun,Dinner,2
181 | 180,34.63,3.55,Male,Yes,Sun,Dinner,2
182 | 181,34.65,3.68,Male,Yes,Sun,Dinner,4
183 | 182,23.33,5.65,Male,Yes,Sun,Dinner,2
184 | 183,45.35,3.5,Male,Yes,Sun,Dinner,3
185 | 184,23.17,6.5,Male,Yes,Sun,Dinner,4
186 | 185,40.55,3.0,Male,Yes,Sun,Dinner,2
187 | 186,20.69,5.0,Male,No,Sun,Dinner,5
188 | 187,20.9,3.5,Female,Yes,Sun,Dinner,3
189 | 188,30.46,2.0,Male,Yes,Sun,Dinner,5
190 | 189,18.15,3.5,Female,Yes,Sun,Dinner,3
191 | 190,23.1,4.0,Male,Yes,Sun,Dinner,3
192 | 191,15.69,1.5,Male,Yes,Sun,Dinner,2
193 | 192,19.81,4.19,Female,Yes,Thur,Lunch,2
194 | 193,28.44,2.56,Male,Yes,Thur,Lunch,2
195 | 194,15.48,2.02,Male,Yes,Thur,Lunch,2
196 | 195,16.58,4.0,Male,Yes,Thur,Lunch,2
197 | 196,7.5600000000000005,1.44,Male,No,Thur,Lunch,2
198 | 197,10.34,2.0,Male,Yes,Thur,Lunch,2
199 | 198,43.11,5.0,Female,Yes,Thur,Lunch,4
200 | 199,13.0,2.0,Female,Yes,Thur,Lunch,2
201 | 200,13.51,2.0,Male,Yes,Thur,Lunch,2
202 | 201,18.71,4.0,Male,Yes,Thur,Lunch,3
203 | 202,12.74,2.01,Female,Yes,Thur,Lunch,2
204 | 203,13.0,2.0,Female,Yes,Thur,Lunch,2
205 | 204,16.4,2.5,Female,Yes,Thur,Lunch,2
206 | 205,20.53,4.0,Male,Yes,Thur,Lunch,4
207 | 206,16.47,3.23,Female,Yes,Thur,Lunch,3
208 | 207,26.59,3.41,Male,Yes,Sat,Dinner,3
209 | 208,38.73,3.0,Male,Yes,Sat,Dinner,4
210 | 209,24.27,2.03,Male,Yes,Sat,Dinner,2
211 | 210,12.76,2.23,Female,Yes,Sat,Dinner,2
212 | 211,30.06,2.0,Male,Yes,Sat,Dinner,3
213 | 212,25.89,5.16,Male,Yes,Sat,Dinner,4
214 | 213,48.33,9.0,Male,No,Sat,Dinner,4
215 | 214,13.27,2.5,Female,Yes,Sat,Dinner,2
216 | 215,28.17,6.5,Female,Yes,Sat,Dinner,3
217 | 216,12.9,1.1,Female,Yes,Sat,Dinner,2
218 | 217,28.15,3.0,Male,Yes,Sat,Dinner,5
219 | 218,11.59,1.5,Male,Yes,Sat,Dinner,2
220 | 219,7.74,1.44,Male,Yes,Sat,Dinner,2
221 | 220,30.14,3.09,Female,Yes,Sat,Dinner,4
222 | 221,12.16,2.2,Male,Yes,Fri,Lunch,2
223 | 222,13.42,3.48,Female,Yes,Fri,Lunch,2
224 | 223,8.58,1.92,Male,Yes,Fri,Lunch,1
225 | 224,15.98,3.0,Female,No,Fri,Lunch,3
226 | 225,13.42,1.58,Male,Yes,Fri,Lunch,2
227 | 226,16.27,2.5,Female,Yes,Fri,Lunch,2
228 | 227,10.09,2.0,Female,Yes,Fri,Lunch,2
229 | 228,20.45,3.0,Male,No,Sat,Dinner,4
230 | 229,13.28,2.72,Male,No,Sat,Dinner,2
231 | 230,22.12,2.88,Female,Yes,Sat,Dinner,2
232 | 231,24.01,2.0,Male,Yes,Sat,Dinner,4
233 | 232,15.69,3.0,Male,Yes,Sat,Dinner,3
234 | 233,11.61,3.39,Male,No,Sat,Dinner,2
235 | 234,10.77,1.47,Male,No,Sat,Dinner,2
236 | 235,15.53,3.0,Male,Yes,Sat,Dinner,2
237 | 236,10.07,1.25,Male,No,Sat,Dinner,2
238 | 237,12.6,1.0,Male,Yes,Sat,Dinner,2
239 | 238,32.83,1.17,Male,Yes,Sat,Dinner,2
240 | 239,35.83,4.67,Female,No,Sat,Dinner,3
241 | 240,29.03,5.92,Male,No,Sat,Dinner,3
242 | 241,27.18,2.0,Female,Yes,Sat,Dinner,2
243 | 242,22.67,2.0,Male,Yes,Sat,Dinner,2
244 | 243,17.82,1.75,Male,No,Sat,Dinner,2
245 | 244,18.78,3.0,Female,No,Thur,Dinner,2
246 |
--------------------------------------------------------------------------------
/ipypivot/data/weather.csv:
--------------------------------------------------------------------------------
1 | Date,Max Temp (C),Min Temp (C),Mean Temp (C),Total Rain (mm),Total Snow (cm)
2 | 2014-01-01,-16.5,-24.6,-20.6,0,0
3 | 2014-01-02,-22.6,-27.3,-25,0,1.4
4 | 2014-01-03,-19.2,-24.3,-21.8,0,0
5 | 2014-01-04,-8.6,-23.3,-16,0,0
6 | 2014-01-05,0.3,-12.6,-6.2,12.2,1.8
7 | 2014-01-06,7.1,-11.1,-2,14.3,0.4
8 | 2014-01-07,-11.1,-16.6,-13.9,0,0.2
9 | 2014-01-08,-8.7,-14.7,-11.7,0,0
10 | 2014-01-09,-7.8,-12.3,-10.1,0,0
11 | 2014-01-10,-4.5,-14.2,-9.4,0,0
12 | 2014-01-11,7.3,-6.4,0.5,6.2,0
13 | 2014-01-12,4.5,0.3,2.4,0,0
14 | 2014-01-13,5.1,-0.9,2.1,0,0
15 | 2014-01-14,4.2,-1.3,1.5,5.4,0
16 | 2014-01-15,1.9,-4.1,-1.1,0.2,0
17 | 2014-01-16,-0.5,-5.1,-2.8,0,0
18 | 2014-01-17,0.6,-5.2,-2.3,0,0.6
19 | 2014-01-18,2.4,-7,-2.3,0,0.2
20 | 2014-01-19,-2.2,-6.4,-4.3,0,1.4
21 | 2014-01-20,-6.4,-20.7,-13.6,0,1.6
22 | 2014-01-21,-19.1,-23.8,-21.5,0,0
23 | 2014-01-22,-17.6,-25.4,-21.5,0,0
24 | 2014-01-23,-17.5,-23.2,-20.4,0,0
25 | 2014-01-24,-9.7,-23.8,-16.8,0,0
26 | 2014-01-25,-5.3,-15.5,-10.4,0,2
27 | 2014-01-26,-13.8,-21.5,-17.7,0,0.4
28 | 2014-01-27,-6.4,-17.9,-12.2,0,5.6
29 | 2014-01-28,-10.8,-19.9,-15.4,0,0
30 | 2014-01-29,-9.6,-14.2,-11.9,0,0
31 | 2014-01-30,-4.4,-12.7,-8.6,0,0
32 | 2014-01-31,1.3,-7.1,-2.9,0,0
33 | 2014-02-01,-1.3,-10.9,-6.1,0,12
34 | 2014-02-02,-1.1,-7.9,-4.5,0,4.6
35 | 2014-02-03,-6.9,-15.3,-11.1,0,0
36 | 2014-02-04,-6.1,-16.8,-11.5,0,0
37 | 2014-02-05,-7.9,-15.6,-11.8,0,5.4
38 | 2014-02-06,-9.3,-20,-14.7,0,0.4
39 | 2014-02-07,-7.6,-12.9,-10.3,0,0
40 | 2014-02-08,-5.7,-12.3,-9,0,0
41 | 2014-02-09,-7.1,-12.5,-9.8,0,1.4
42 | 2014-02-10,-6.8,-16.1,-11.5,0,0.4
43 | 2014-02-11,-11.1,-19.6,-15.4,0,0
44 | 2014-02-12,-9.8,-23.1,-16.5,0,0
45 | 2014-02-13,-6.1,-18.4,-12.3,0,2
46 | 2014-02-14,-2.2,-6.1,-4.2,0,12.4
47 | 2014-02-15,-5.6,-11.8,-8.7,0,0
48 | 2014-02-16,-9.5,-15.8,-12.7,0,0
49 | 2014-02-17,-9.9,-17.4,-13.7,0,0
50 | 2014-02-18,-3.4,-15.6,-9.5,0,2.4
51 | 2014-02-19,1.5,-5.4,-2,0,0
52 | 2014-02-20,2.8,-4.9,-1.1,0,0
53 | 2014-02-21,4.2,-0.6,1.8,19.2,0
54 | 2014-02-22,6.1,-1.8,2.2,0,0
55 | 2014-02-23,1.7,-4.3,-1.3,0,0
56 | 2014-02-24,-4.3,-10.6,-7.5,0,0.2
57 | 2014-02-25,-9,-12.9,-11,0,0
58 | 2014-02-26,-9.7,-14.8,-12.3,0,1.6
59 | 2014-02-27,-6.9,-14.8,-10.9,0,0.4
60 | 2014-02-28,-12.1,-18.2,-15.2,0,0
61 | 2014-03-01,-3.4,-14.2,-8.8,0,2
62 | 2014-03-02,-5.5,-16.6,-11.1,0,0.6
63 | 2014-03-03,-13,-18.1,-15.6,0,0
64 | 2014-03-04,-11,-18.5,-14.8,0,1.4
65 | 2014-03-05,-9,-17.6,-13.3,0,0
66 | 2014-03-06,-6.9,-19.4,-13.2,0,0
67 | 2014-03-07,0.2,-17.8,-8.8,0,0
68 | 2014-03-08,3.3,-6.2,-1.5,0,0.8
69 | 2014-03-09,-3.8,-12.6,-8.2,0,3
70 | 2014-03-10,0.7,-5.4,-2.4,0,4
71 | 2014-03-11,5.2,0.2,2.7,0,0
72 | 2014-03-12,1.7,-11.9,-5.1,0,16.6
73 | 2014-03-13,-6.7,-15.6,-11.2,0,2.4
74 | 2014-03-14,2.1,-16.7,-7.3,0,0
75 | 2014-03-15,4.6,-8.4,-1.9,0.2,0.2
76 | 2014-03-16,-8.4,-14.1,-11.3,0,0
77 | 2014-03-17,-6.8,-16.8,-11.8,0,0
78 | 2014-03-18,-2.1,-13.8,-8,0,0
79 | 2014-03-19,3.2,-9,-2.9,1.4,0.4
80 | 2014-03-20,2.9,-0.3,1.3,2.4,0.2
81 | 2014-03-21,2.5,-3,-0.3,0,0.2
82 | 2014-03-22,0.6,-3.8,-1.6,0,9.6
83 | 2014-03-23,0,-13.6,-6.8,0,0
84 | 2014-03-24,-4.7,-16.5,-10.6,0,0
85 | 2014-03-25,-0.6,-11.7,-6.2,0,0
86 | 2014-03-26,-2.4,-10.4,-6.4,0,0
87 | 2014-03-27,-1.6,-13.1,-7.4,0,0.2
88 | 2014-03-28,4.1,-2.7,0.7,9.2,4.2
89 | 2014-03-29,3.2,0.5,1.9,0,0
90 | 2014-03-30,0.5,-1.4,-0.5,0,15.2
91 | 2014-03-31,6.2,-1.8,2.2,0,0
92 | 2014-04-01,5,-3.5,0.8,0,0
93 | 2014-04-02,5,1.2,3.1,0,0
94 | 2014-04-03,2.9,-2.2,0.4,0,0
95 | 2014-04-04,7,-3.4,1.8,16.8,0
96 | 2014-04-05,4.7,0.4,2.6,1.2,0
97 | 2014-04-06,7.1,-1.2,3,0,0
98 | 2014-04-07,13,-0.1,6.5,6.4,0
99 | 2014-04-08,5.2,2.6,3.9,22.6,0
100 | 2014-04-09,4.8,-0.9,2,0,0
101 | 2014-04-10,16.2,-1.6,7.3,4,0
102 | 2014-04-11,11.8,2.9,7.4,0,0
103 | 2014-04-12,14.3,1.5,7.9,0,0
104 | 2014-04-13,11.7,2.6,7.2,8.2,0
105 | 2014-04-14,24.5,2.2,13.4,9,0
106 | 2014-04-15,16.2,-5.1,5.6,8.6,0.4
107 | 2014-04-16,0.6,-7.3,-3.4,0,0
108 | 2014-04-17,7.7,-2.9,2.4,0,0
109 | 2014-04-18,10.8,1.7,6.3,0,0
110 | 2014-04-19,10.6,0.9,5.8,0.4,0
111 | 2014-04-20,14.1,-2.6,5.8,0,0
112 | 2014-04-21,19.2,7.4,13.3,1.2,0
113 | 2014-04-22,12.7,7,9.9,10.4,0
114 | 2014-04-23,11.8,3.6,7.7,0,0
115 | 2014-04-24,13.2,1.4,7.3,0,0
116 | 2014-04-25,11.9,-0.3,5.8,0,0
117 | 2014-04-26,8.4,2.8,5.6,11.4,0
118 | 2014-04-27,10.4,2.3,6.4,2,0
119 | 2014-04-28,12.3,1.8,7.1,0,0
120 | 2014-04-29,16.5,5.7,11.1,2.8,0
121 | 2014-04-30,10.6,5.1,7.9,30.8,0
122 | 2014-05-01,16.1,6.1,11.1,8.2,0
123 | 2014-05-02,13,8.1,10.6,0.6,0
124 | 2014-05-03,16.3,7.9,12.1,0.8,0
125 | 2014-05-04,12,7.3,9.7,19.4,0
126 | 2014-05-05,13.4,6.3,9.9,0,0
127 | 2014-05-06,15,4.2,9.6,0,0
128 | 2014-05-07,15.8,3.2,9.5,0,0
129 | 2014-05-08,16.8,5.2,11,0,0
130 | 2014-05-09,20.8,8.8,14.8,4.2,0
131 | 2014-05-10,23.8,11.9,17.9,4.4,0
132 | 2014-05-11,21.9,11.4,16.7,0,0
133 | 2014-05-12,22.4,9.1,15.8,0,0
134 | 2014-05-13,18.4,8.3,13.4,1.4,0
135 | 2014-05-14,24.9,13.6,19.3,0,0
136 | 2014-05-15,28.2,17.5,22.9,0,0
137 | 2014-05-16,22.2,10.3,16.3,29.8,0
138 | 2014-05-17,15.4,8.3,11.9,10.8,0
139 | 2014-05-18,16.6,6.3,11.5,0,0
140 | 2014-05-19,20.2,9.2,14.7,0,0
141 | 2014-05-20,22.8,8.7,15.8,0,0
142 | 2014-05-21,23.8,10.4,17.1,0,0
143 | 2014-05-22,19,12.9,16,1,0
144 | 2014-05-23,20.8,10.8,15.8,0,0
145 | 2014-05-24,21.4,11.4,16.4,0,0
146 | 2014-05-25,25.2,9.4,17.3,4.6,0
147 | 2014-05-26,22.8,16.3,19.6,3.6,0
148 | 2014-05-27,16.9,8.6,12.8,4.2,0
149 | 2014-05-28,16.1,8.1,12.1,0.6,0
150 | 2014-05-29,20.5,6.1,13.3,0,0
151 | 2014-05-30,22.6,12,17.3,2,0
152 | 2014-05-31,20.2,9.1,14.7,0,0
153 | 2014-06-01,25.2,9.7,17.5,0,0
154 | 2014-06-02,30.4,15.7,23.1,0,0
155 | 2014-06-03,28.1,19.1,23.6,22,0
156 | 2014-06-04,21.3,14,17.7,0.2,0
157 | 2014-06-05,17,13.4,15.2,0.6,0
158 | 2014-06-06,23,12.9,18,0,0
159 | 2014-06-07,27.5,13.3,20.4,0,0
160 | 2014-06-08,28,14.6,21.3,0,0
161 | 2014-06-09,27.9,19.2,23.6,0,0
162 | 2014-06-10,24.6,15.8,20.2,0.4,0
163 | 2014-06-11,24.1,13.1,18.6,10.4,0
164 | 2014-06-12,17.9,12.9,15.4,26.2,0
165 | 2014-06-13,19.9,16.8,18.4,41.4,0
166 | 2014-06-14,19.8,14.6,17.2,1.4,0
167 | 2014-06-15,23.6,13.6,18.6,0,0
168 | 2014-06-16,24.8,11.4,18.1,0,0
169 | 2014-06-17,27.2,14,20.6,23.4,0
170 | 2014-06-18,25.7,16.6,21.2,2,0
171 | 2014-06-19,24.6,14.6,19.6,0,0
172 | 2014-06-20,21.7,12.1,16.9,0,0
173 | 2014-06-21,22.1,10.4,16.3,0,0
174 | 2014-06-22,23.8,11.5,17.7,0,0
175 | 2014-06-23,26.8,13.4,20.1,0,0
176 | 2014-06-24,21.9,19.2,20.6,40,0
177 | 2014-06-25,24,18.2,21.1,0.2,0
178 | 2014-06-26,26.3,17,21.7,0,0
179 | 2014-06-27,28.4,15,21.7,0,0
180 | 2014-06-28,29.2,16.3,22.8,0,0
181 | 2014-06-29,30.7,19.1,24.9,0,0
182 | 2014-06-30,29.7,22.8,26.3,0,0
183 | 2014-07-01,33.2,21.6,27.4,0,0
184 | 2014-07-02,29.8,21.2,25.5,0,0
185 | 2014-07-03,24.4,18.9,21.7,0.6,0
186 | 2014-07-04,23.4,16,19.7,3.2,0
187 | 2014-07-05,27.7,14.5,21.1,0,0
188 | 2014-07-06,27.7,18.7,23.2,0,0
189 | 2014-07-07,23.4,19.5,21.5,10,0
190 | 2014-07-08,30.6,19,24.8,7,0
191 | 2014-07-09,23.5,17.7,20.6,0,0
192 | 2014-07-10,23.1,14.3,18.7,0,0
193 | 2014-07-11,25.4,13.4,19.4,0,0
194 | 2014-07-12,27.4,16,21.7,0,0
195 | 2014-07-13,23.9,19.6,21.8,11,0
196 | 2014-07-14,24.1,17.6,20.9,0,0
197 | 2014-07-15,21.9,17.6,19.8,2.8,0
198 | 2014-07-16,24.8,16.6,20.7,0,0
199 | 2014-07-17,23.4,14,18.7,0.2,0
200 | 2014-07-18,26.2,14,20.1,0,0
201 | 2014-07-19,27.5,16.5,22,0,0
202 | 2014-07-20,28,18.9,23.5,0,0
203 | 2014-07-21,29.4,20.8,25.1,0,0
204 | 2014-07-22,29.7,20.5,25.1,0,0
205 | 2014-07-23,26.4,17.7,22.1,11.4,0
206 | 2014-07-24,22.9,13.8,18.4,0,0
207 | 2014-07-25,25.8,14.7,20.3,0,0
208 | 2014-07-26,26,15.9,21,0.2,0
209 | 2014-07-27,25,18,21.5,10.2,0
210 | 2014-07-28,18.5,14.2,16.4,9.8,0
211 | 2014-07-29,21.3,12,16.7,0,0
212 | 2014-07-30,24,13.8,18.9,0.8,0
213 | 2014-07-31,21.8,14.3,18.1,12.8,0
214 | 2014-08-01,26.1,14.8,20.5,0,0
215 | 2014-08-02,27.8,16.1,22,0,0
216 | 2014-08-03,28,16.6,22.3,0,0
217 | 2014-08-04,27.7,18.3,23,0.6,0
218 | 2014-08-05,25.4,17.7,21.6,1.6,0
219 | 2014-08-06,25.6,14.9,20.3,0,0
220 | 2014-08-07,23.1,15.9,19.5,6.2,0
221 | 2014-08-08,27,14,20.5,0,0
222 | 2014-08-09,28.7,15.4,22.1,0,0
223 | 2014-08-10,28.6,16.6,22.6,0,0
224 | 2014-08-11,29.7,17.8,23.8,0,0
225 | 2014-08-12,27.9,19.1,23.5,2.2,0
226 | 2014-08-13,21.1,16,18.6,44.4,0
227 | 2014-08-14,17.6,12,14.8,0,0
228 | 2014-08-15,17.5,12.2,14.9,5.2,0
229 | 2014-08-16,18.5,14.6,16.6,13.2,0
230 | 2014-08-17,22.8,14.6,18.7,0,0
231 | 2014-08-18,22.2,11.7,17,0,0
232 | 2014-08-19,23.5,10.6,17.1,0,0
233 | 2014-08-20,27.3,12.8,20.1,0,0
234 | 2014-08-21,23.1,17.9,20.5,0,0
235 | 2014-08-22,23.8,17.3,20.6,0,0
236 | 2014-08-23,26,14.7,20.4,0,0
237 | 2014-08-24,27.7,14.5,21.1,0,0
238 | 2014-08-25,28.9,17.6,23.3,0,0
239 | 2014-08-26,28.6,17,22.8,0.4,0
240 | 2014-08-27,25.6,18.4,22,0,0
241 | 2014-08-28,21.9,14.2,18.1,0,0
242 | 2014-08-29,22.6,11.4,17,0,0
243 | 2014-08-30,27.3,16.7,22,0.2,0
244 | 2014-08-31,25.3,19.8,22.6,11.2,0
245 | 2014-09-01,25.9,18.7,22.3,0,0
246 | 2014-09-02,28.6,18.3,23.5,4.4,0
247 | 2014-09-03,25.5,18,21.8,0,0
248 | 2014-09-04,27.7,16.3,22,0.4,0
249 | 2014-09-05,30.8,20.1,25.5,3,0
250 | 2014-09-06,23.2,10.6,16.9,5,0
251 | 2014-09-07,22.1,10.6,16.4,0,0
252 | 2014-09-08,24.7,11.4,18.1,0,0
253 | 2014-09-09,23.1,14.3,18.7,0,0
254 | 2014-09-10,24.8,14.6,19.7,0,0
255 | 2014-09-11,25.1,10.1,17.6,7.2,0
256 | 2014-09-12,14.1,6.1,10.1,0,0
257 | 2014-09-13,12.6,5.9,9.3,19,0
258 | 2014-09-14,10.9,4.6,7.8,0,0
259 | 2014-09-15,18.3,4.8,11.6,0.2,0
260 | 2014-09-16,18.6,9.3,14,0.4,0
261 | 2014-09-17,17.2,8,12.6,2.6,0
262 | 2014-09-18,12.4,3.4,7.9,0.2,0
263 | 2014-09-19,13,1.2,7.1,0,0
264 | 2014-09-20,19.8,9.2,14.5,0.2,0
265 | 2014-09-21,23.2,14,18.6,6.2,0
266 | 2014-09-22,14,6.9,10.5,0,0
267 | 2014-09-23,17.2,7.3,12.3,1.2,0
268 | 2014-09-24,21.8,6.7,14.3,0,0
269 | 2014-09-25,22.8,10.8,16.8,0,0
270 | 2014-09-26,25.5,11.9,18.7,0,0
271 | 2014-09-27,25.5,12.8,19.2,0,0
272 | 2014-09-28,24.8,14.8,19.8,0,0
273 | 2014-09-29,18,8.7,13.4,0,0
274 | 2014-09-30,17.3,9.3,13.3,0,0
275 | 2014-10-01,16.6,10.4,13.5,0,0
276 | 2014-10-02,20.3,8.7,14.5,0,0
277 | 2014-10-03,23.1,8.8,16,0,0
278 | 2014-10-04,16.6,9.8,13.2,23.6,0
279 | 2014-10-05,13.7,7.9,10.8,0,0
280 | 2014-10-06,16.3,8,12.2,0.4,0
281 | 2014-10-07,18.2,11.9,15.1,4,0
282 | 2014-10-08,17.5,8.7,13.1,19.8,0
283 | 2014-10-09,12.5,5.2,8.9,0.8,0
284 | 2014-10-10,11.8,4.6,8.2,0,0
285 | 2014-10-11,13.1,2.6,7.9,0,0
286 | 2014-10-12,13.2,2.6,7.9,0,0
287 | 2014-10-13,17.8,2.2,10,0,0
288 | 2014-10-14,24.8,13.7,19.3,0,0
289 | 2014-10-15,23.6,18.2,20.9,6.4,0
290 | 2014-10-16,21.7,14.6,18.2,7.6,0
291 | 2014-10-17,18.4,14.3,16.4,0.4,0
292 | 2014-10-18,16.9,5.9,11.4,1.4,0
293 | 2014-10-19,7.5,3,5.3,0,0
294 | 2014-10-20,6.8,1.8,4.3,1.2,0
295 | 2014-10-21,7.4,5.6,6.5,3,0
296 | 2014-10-22,12.6,6,9.3,0,0
297 | 2014-10-23,8.6,6.9,7.8,5.8,0
298 | 2014-10-24,11.5,4.9,8.2,1,0
299 | 2014-10-25,13.1,5.2,9.2,3.8,0
300 | 2014-10-26,10.9,7.2,9.1,0.8,0
301 | 2014-10-27,11.2,5.7,8.5,0.2,0
302 | 2014-10-28,13.7,7,10.4,6.2,0
303 | 2014-10-29,14.2,8.5,11.4,0.6,0
304 | 2014-10-30,10,2.8,6.4,0,0
305 | 2014-10-31,7.2,1.5,4.4,0,0
306 | 2014-11-01,6.9,1.9,4.4,0,0
307 | 2014-11-02,7.6,-0.3,3.7,0,0
308 | 2014-11-03,6.3,-1,2.7,0,0
309 | 2014-11-04,11.7,4.3,8,2.4,0
310 | 2014-11-05,12.2,5.7,9,2,0
311 | 2014-11-06,8.3,2.6,5.5,3,0
312 | 2014-11-07,4.8,-0.2,2.3,1.8,0
313 | 2014-11-08,4.4,-1.4,1.5,0.2,0
314 | 2014-11-09,6.5,2.7,4.6,0,0
315 | 2014-11-10,7.1,3.5,5.3,0,0
316 | 2014-11-11,12.5,0.2,6.4,0,0
317 | 2014-11-12,8.4,1.6,5,3.8,0
318 | 2014-11-13,4.7,-0.8,2,0,0
319 | 2014-11-14,2.1,-4,-1,0,0
320 | 2014-11-15,1.6,-4.9,-1.7,0,0
321 | 2014-11-16,3.3,-0.6,1.4,0,0.8
322 | 2014-11-17,1.5,-0.6,0.5,0,12.6
323 | 2014-11-18,1.5,-4.7,-1.6,0,2
324 | 2014-11-19,-2,-7.7,-4.9,0,0.6
325 | 2014-11-20,-0.1,-5.1,-2.6,0,0.4
326 | 2014-11-21,-4.6,-8.2,-6.4,0,0
327 | 2014-11-22,3,-7.9,-2.5,3.4,0.4
328 | 2014-11-23,7.9,2.8,5.4,0,0
329 | 2014-11-24,18,6.8,12.4,16,0
330 | 2014-11-25,7.8,2,4.9,0,0
331 | 2014-11-26,2.5,-0.9,0.8,0,0
332 | 2014-11-27,-0.1,-3.8,-2,0,0
333 | 2014-11-28,-2.8,-8.2,-5.5,0,0.4
334 | 2014-11-29,-0.8,-8.3,-4.6,0,0
335 | 2014-11-30,6.8,-0.9,3,0.6,0
336 | 2014-12-01,6.2,-8.7,-1.3,0.2,0
337 | 2014-12-02,-3.2,-14.9,-9.1,0,6.2
338 | 2014-12-03,3.3,-3.2,0.1,5.4,0.6
339 | 2014-12-04,0.1,-11.3,-5.6,0,0
340 | 2014-12-05,-4.6,-13.1,-8.9,0,2.2
341 | 2014-12-06,-1.1,-6,-3.6,0,0.6
342 | 2014-12-07,-4.9,-12.9,-8.9,0,0
343 | 2014-12-08,-2.3,-13.9,-8.1,0,0
344 | 2014-12-09,0.2,-4.8,-2.3,0,6.8
345 | 2014-12-10,0.2,-0.8,-0.3,0,20
346 | 2014-12-11,0.4,-3.2,-1.4,0.2,4.8
347 | 2014-12-12,-1.7,-4.2,-3,0,2
348 | 2014-12-13,-1.6,-5.9,-3.8,0,0
349 | 2014-12-14,-0.9,-4.8,-2.9,0,0
350 | 2014-12-15,-0.1,-1.9,-1,0,0
351 | 2014-12-16,0.6,-1.4,-0.4,0,0
352 | 2014-12-17,0.6,-0.2,0.2,2,0.2
353 | 2014-12-18,0.4,-2.4,-1,0,2
354 | 2014-12-19,-2.4,-11.5,-7,0,0
355 | 2014-12-20,-7.7,-15.6,-11.7,0,0
356 | 2014-12-21,-7.2,-10.3,-8.8,0,0.2
357 | 2014-12-22,-5.5,-8.6,-7.1,0,0
358 | 2014-12-23,3.1,-5.8,-1.4,2.6,3
359 | 2014-12-24,6.2,2.3,4.3,32,0
360 | 2014-12-25,7.8,3.5,5.7,1,0
361 | 2014-12-26,4.5,1.4,3,0,0
362 | 2014-12-27,7.4,0.9,4.2,0.2,0
363 | 2014-12-28,8.3,-3.3,2.5,0.8,0
364 | 2014-12-29,-0.7,-11.1,-5.9,0,0
365 | 2014-12-30,-10.6,-14.5,-12.6,0,0
366 | 2014-12-31,-6.3,-14.9,-10.6,0,0
--------------------------------------------------------------------------------
/ipypivot/data/mps.csv:
--------------------------------------------------------------------------------
1 | Name,Party,Province,Age,Gender
2 | "Liu, Laurin",NDP,Quebec,22,Female
3 | "Mourani, Maria",Bloc Quebecois,Quebec,43,Female
4 | "Sellah, Djaouida",NDP,Quebec,,Female
5 | "St-Denis, Lise",NDP,Quebec,72,Female
6 | "Fry, Hedy",Liberal,British Columbia,71,Female
7 | "Turmel, Nycole",NDP,Quebec,70,Female
8 | "Sgro, Judy",Liberal,Ontario,68,Female
9 | "Raynault, Francine",NDP,Quebec,67,Female
10 | "Davidson, Patricia",Conservative,Ontario,66,Female
11 | "Smith, Joy",Conservative,Manitoba,65,Female
12 | "Wong, Alice",Conservative,British Columbia,64,Female
13 | "O'Neill Gordon, Tilly",Conservative,New Brunswick,63,Female
14 | "Ablonczy, Diane",Conservative,Alberta,63,Female
15 | "Duncan, Linda Francis",NDP,Alberta,63,Female
16 | "Bennett, Carolyn",Liberal,Ontario,62,Female
17 | "Nash, Peggy",NDP,Ontario,61,Female
18 | "Mathyssen, Irene",NDP,Ontario,61,Female
19 | "Sims, Jinny Jogindera",NDP,British Columbia,60,Female
20 | "Foote, Judy",Liberal,Newfoundland and Labrador,60,Female
21 | "Crowder, Jean",NDP,British Columbia,60,Female
22 | "Davies, Libby",NDP,British Columbia,59,Female
23 | "Yelich, Lynne",Conservative,Saskatchewan,59,Female
24 | "Day, Anne-Marie",NDP,Quebec,58,Female
25 | "May, Elizabeth",Green,British Columbia,58,Female
26 | "Murray, Joyce",Liberal,British Columbia,58,Female
27 | "Findlay, Kerry-Lynne D.",Conservative,British Columbia,57,Female
28 | "Brown, Lois",Conservative,Ontario,57,Female
29 | "Laverdière, Hélène",NDP,Quebec,57,Female
30 | "Boutin-Sweet, Marjolaine",NDP,Quebec,57,Female
31 | "Crockatt, Joan",Conservative,Alberta,56,Female
32 | "Chow, Olivia",NDP,Ontario,55,Female
33 | "McLeod, Cathy",Conservative,British Columbia,55,Female
34 | "Finley, Diane",Conservative,Ontario,55,Female
35 | "LeBlanc, Hélène",NDP,Quebec,54,Female
36 | "Grewal, Nina",Conservative,British Columbia,54,Female
37 | "Hughes, Carol",NDP,Ontario,54,Female
38 | "Shea, Gail",Conservative,Prince Edward Island,53,Female
39 | "Truppe, Susan",Conservative,Ontario,53,Female
40 | "Young, Wai",Conservative,British Columbia,52,Female
41 | "Gallant, Cheryl",Conservative,Ontario,52,Female
42 | "Boivin, Françoise",NDP,Quebec,52,Female
43 | "Block, Kelly",Conservative,Saskatchewan,51,Female
44 | "Ayala, Paulina",NDP,Quebec,50,Female
45 | "Groguhé, Sadia",NDP,Quebec,50,Female
46 | "Charlton, Chris",NDP,Ontario,49,Female
47 | "Bergen, Candice",Conservative,Manitoba,48,Female
48 | "Perreault, Manon",NDP,Quebec,46,Female
49 | "James, Roxanne",Conservative,Ontario,46,Female
50 | "Ambler, Stella",Conservative,Ontario,46,Female
51 | "Duncan, Kirsty",Liberal,Ontario,46,Female
52 | "Glover, Shelly",Conservative,Manitoba,45,Female
53 | "Aglukkaq, Leona",Conservative,Territories,45,Female
54 | "Raitt, Lisa",Conservative,Ontario,44,Female
55 | "Ambrose, Rona",Conservative,Alberta,43,Female
56 | "Leitch, Kellie",Conservative,Ontario,42,Female
57 | "Leslie, Megan",NDP,Nova Scotia,39,Female
58 | "Hassainia, Sana",NDP,Quebec,38,Female
59 | "Adams, Eve",Conservative,Ontario,38,Female
60 | "Rempel, Michelle",Conservative,Alberta,32,Female
61 | "Papillon, Annick",NDP,Quebec,32,Female
62 | "Sitsabaiesan, Rathika",NDP,Ontario,31,Female
63 | "Quach, Anne Minh-Thu",NDP,Quebec,30,Female
64 | "Ashton, Niki",NDP,Manitoba,30,Female
65 | "Moore, Christine",NDP,Quebec,29,Female
66 | "Morin, Isabelle",NDP,Quebec,28,Female
67 | "Blanchette-Lamothe, Lysane",NDP,Quebec,28,Female
68 | "Brosseau, Ruth Ellen",NDP,Quebec,28,Female
69 | "Latendresse, Alexandrine",NDP,Quebec,28,Female
70 | "Doré Lefebvre, Rosane",NDP,Quebec,28,Female
71 | "Morin, Marie-Claude",NDP,Quebec,27,Female
72 | "Michaud, Élaine",NDP,Quebec,27,Female
73 | "Péclet, Ève",NDP,Quebec,24,Female
74 | "Freeman, Mylène",NDP,Quebec,23,Female
75 | "Borg, Charmaine",NDP,Quebec,22,Female
76 | "Bateman, Joyce",Conservative,Manitoba,,Female
77 | "Hiebert, Russ",Conservative,British Columbia,43,Male
78 | "Jacob, Pierre",NDP,Quebec,59,Male
79 | "Vellacott, Maurice",Conservative,Saskatchewan,57,Male
80 | "Boughen, Ray",Conservative,Saskatchewan,75,Male
81 | "O'Connor, Gordon",Conservative,Ontario,73,Male
82 | "Cotler, Irwin",Liberal,Quebec,72,Male
83 | "Oliver, Joe",Conservative,Ontario,72,Male
84 | "Tilson, David Allan",Conservative,Ontario,71,Male
85 | "Fantino, Julian",Conservative,Ontario,70,Male
86 | "Kent, Peter",Conservative,Ontario,69,Male
87 | "Plamondon, Louis",Bloc Quebecois,Quebec,69,Male
88 | "Schellenberger, Gary",Conservative,Ontario,69,Male
89 | "Lauzon, Guy",Conservative,Ontario,68,Male
90 | "Harris, Richard M.",Conservative,British Columbia,68,Male
91 | "Goldring, Peter",Conservative,Alberta,68,Male
92 | "Atamanenko, Alex",NDP,British Columbia,67,Male
93 | "Payne, LaVar",Conservative,Alberta,67,Male
94 | "Breitkreuz, Garry W.",Conservative,Saskatchewan,67,Male
95 | "Genest, Réjean",NDP,Quebec,66,Male
96 | "MacKenzie, Dave",Conservative,Ontario,66,Male
97 | "Hyer, Bruce",NDP,Ontario,66,Male
98 | "MacAulay, Lawrence",Liberal,Prince Edward Island,66,Male
99 | "Galipeau, Royal",Conservative,Ontario,65,Male
100 | "Marston, Wayne",NDP,Ontario,65,Male
101 | "Hawn, Laurie",Conservative,Alberta,65,Male
102 | "Kramp, Daryl",Conservative,Ontario,65,Male
103 | "Shipley, Bev",Conservative,Ontario,65,Male
104 | "Kerr, Greg",Conservative,Nova Scotia,65,Male
105 | "Comartin, Joe",NDP,Ontario,65,Male
106 | "Norlock, Rick",Conservative,Ontario,64,Male
107 | "McKay, John",Liberal,Ontario,64,Male
108 | "Mayes, Colin",Conservative,British Columbia,64,Male
109 | "Rae, Bob",Liberal,Ontario,64,Male
110 | "Harris, Jack",NDP,Newfoundland and Labrador,64,Male
111 | "Duncan, John",Conservative,British Columbia,64,Male
112 | "Chisu, Corneliu",Conservative,Ontario,63,Male
113 | "Garneau, Marc",Liberal,Quebec,63,Male
114 | "Easter, Arnold Wayne",Liberal,Prince Edward Island,63,Male
115 | "Aspin, Jay",Conservative,Ontario,63,Male
116 | "Goodale, Ralph",Liberal,Saskatchewan,63,Male
117 | "Albrecht, Harold",Conservative,Ontario,63,Male
118 | "Gravelle, Claude",NDP,Ontario,63,Male
119 | "Komarnicki, Ed",Conservative,Saskatchewan,63,Male
120 | "Flaherty, James Michael (Jim)",Conservative,Ontario,62,Male
121 | "Rankin, Murray",NDP,British Columbia,62,Male
122 | "McCallum, John",Liberal,Ontario,62,Male
123 | "Warawa, Mark",Conservative,British Columbia,62,Male
124 | "Obhrai, Deepak",Conservative,Alberta,62,Male
125 | "Benoit, Leon Earl",Conservative,Alberta,62,Male
126 | "Leung, Chungsen",Conservative,Ontario,62,Male
127 | "Morin, Marc-André",NDP,Quebec,61,Male
128 | "Sopuck, Robert",Conservative,Manitoba,61,Male
129 | "Ritz, Gerry",Conservative,Saskatchewan,61,Male
130 | "Garrison, Randall",NDP,British Columbia,61,Male
131 | "Lunney, James",Conservative,British Columbia,61,Male
132 | "Lukiwski, Tom",Conservative,Saskatchewan,61,Male
133 | "Carmichael, John",Conservative,Ontario,60,Male
134 | "Menzies, Ted",Conservative,Alberta,60,Male
135 | "Valcourt, Bernard",Conservative,New Brunswick,60,Male
136 | "Ashfield, Keith",Conservative,New Brunswick,60,Male
137 | "Nicholson, Rob",Conservative,Ontario,60,Male
138 | "Young, Terence H.",Conservative,Ontario,60,Male
139 | "Toews, Vic",Conservative,Manitoba,60,Male
140 | "Sullivan, Mike",NDP,Ontario,60,Male
141 | "Patry, Claude",NDP,Quebec,59,Male
142 | "Keddy, Gerald",Conservative,Nova Scotia,59,Male
143 | "Bevington, Dennis Fraser",NDP,Territories,59,Male
144 | "Allen, Malcolm",NDP,Ontario,59,Male
145 | "Rafferty, John",NDP,Ontario,59,Male
146 | "Dreeshen, Earl",Conservative,Alberta,59,Male
147 | "Kamp, Randy",Conservative,British Columbia,59,Male
148 | "Merrifield, Rob",Conservative,Alberta,59,Male
149 | "Woodworth, Stephen",Conservative,Ontario,58,Male
150 | "McColeman, Phil",Conservative,Ontario,58,Male
151 | "Lebel, Denis",Conservative,Quebec,58,Male
152 | "Lizon, Wladyslaw",Conservative,Ontario,58,Male
153 | "Holder, Ed",Conservative,Ontario,58,Male
154 | "Valeriote, Frank",Liberal,Ontario,58,Male
155 | "Christopherson, David",NDP,Ontario,58,Male
156 | "Mulcair, Thomas J.",NDP,Quebec,58,Male
157 | "Daniel, Joe",Conservative,Ontario,58,Male
158 | "Karygiannis, Jim",Liberal,Ontario,57,Male
159 | "Godin, Yvon",NDP,New Brunswick,57,Male
160 | "Dionne Labelle, Pierre",NDP,Quebec,57,Male
161 | "Preston, Joe",Conservative,Ontario,57,Male
162 | "Bélanger, Mauril",Liberal,Ontario,57,Male
163 | "Fast, Edward",Conservative,British Columbia,57,Male
164 | "Tweed, Mervin C.",Conservative,Manitoba,57,Male
165 | "Dion, Stéphane",Liberal,Quebec,57,Male
166 | "Van Kesteren, Dave",Conservative,Ontario,57,Male
167 | "Cuzner, Rodger",Liberal,Nova Scotia,57,Male
168 | "Martin, Pat",NDP,Manitoba,57,Male
169 | "Stoffer, Peter",NDP,Nova Scotia,56,Male
170 | "Miller, Larry",Conservative,Ontario,56,Male
171 | "Blanchette, Denis",NDP,Quebec,56,Male
172 | "Nunez-Melo, José",NDP,Quebec,56,Male
173 | "Goguen, Robert",Conservative,New Brunswick,55,Male
174 | "Scarpaleggia, Francis",Liberal,Quebec,55,Male
175 | "Sweet, David",Conservative,Ontario,55,Male
176 | "Anderson, David",Conservative,Saskatchewan,55,Male
177 | "Chisholm, Robert",NDP,Nova Scotia,55,Male
178 | "Stanton, Bruce",Conservative,Ontario,55,Male
179 | "Goodyear, Gary",Conservative,Ontario,54,Male
180 | "Weston, John",Conservative,British Columbia,54,Male
181 | "Dechert, Bob",Conservative,Ontario,54,Male
182 | "Shory, Devinder",Conservative,Alberta,54,Male
183 | "Pilon, François",NDP,Quebec,54,Male
184 | "Hayes, Bryan",Conservative,Ontario,54,Male
185 | "Giguère, Alain",NDP,Quebec,54,Male
186 | "Sorenson, Kevin",Conservative,Alberta,54,Male
187 | "Benskin, Tyrone",NDP,Quebec,53,Male
188 | "Menegakis, Costas",Conservative,Ontario,53,Male
189 | "Harper, Stephen",Conservative,Alberta,53,Male
190 | "Wilks, David",Conservative,British Columbia,53,Male
191 | "Regan, Geoff",Liberal,Nova Scotia,53,Male
192 | "McGuinty, David",Liberal,Ontario,52,Male
193 | "Gosal, Bal",Conservative,Ontario,52,Male
194 | "Aubin, Robert",NDP,Quebec,52,Male
195 | "Eyking, Mark",Liberal,Nova Scotia,52,Male
196 | "Brown, Gordon",Conservative,Ontario,52,Male
197 | "Allen, Mike",Conservative,New Brunswick,52,Male
198 | "Clement, Tony",Conservative,Ontario,51,Male
199 | "Cannan, Ronald",Conservative,British Columbia,51,Male
200 | "Rousseau, Jean",NDP,Quebec,51,Male
201 | "Opitz, Ted",Conservative,Ontario,51,Male
202 | "Toet, Lawrence",Conservative,Manitoba,50,Male
203 | "Cash, Andrew",NDP,Ontario,50,Male
204 | "Lamoureux, Kevin",Liberal,Manitoba,50,Male
205 | "Scott, Craig",NDP,Ontario,50,Male
206 | "Adler, Mark",Conservative,Ontario,50,Male
207 | "Carrie, Colin",Conservative,Ontario,50,Male
208 | "Julian, Peter",NDP,British Columbia,50,Male
209 | "Pacetti, Massimo",Liberal,Quebec,50,Male
210 | "Saganash, Romeo",NDP,Quebec,50,Male
211 | "Angus, Charlie",NDP,Ontario,50,Male
212 | "Davies, Don",NDP,British Columbia,49,Male
213 | "Bernier, Maxime",Conservative,Quebec,49,Male
214 | "Dewar, Paul",NDP,Ontario,49,Male
215 | "Jean, Brian",Conservative,Alberta,49,Male
216 | "Devolin, Barry",Conservative,Ontario,49,Male
217 | "Lemieux, Pierre",Conservative,Ontario,49,Male
218 | "Van Loan, Peter",Conservative,Ontario,49,Male
219 | "Casey, Sean",Liberal,Prince Edward Island,49,Male
220 | "Nantel, Pierre",NDP,Quebec,49,Male
221 | "Coderre, Denis",Liberal,Quebec,49,Male
222 | "Wallace, Mike",Conservative,Ontario,49,Male
223 | "Braid, Peter",Conservative,Ontario,48,Male
224 | "Gourde, Jacques",Conservative,Quebec,48,Male
225 | "Reid, Scott",Conservative,Ontario,48,Male
226 | "Hsu, Ted",Liberal,Ontario,48,Male
227 | "Saxton, Andrew",Conservative,British Columbia,48,Male
228 | "Weston, Rodney",Conservative,New Brunswick,48,Male
229 | "Penashue, Peter",Conservative,Newfoundland and Labrador,48,Male
230 | "Bellavance, André",Bloc Quebecois,Quebec,48,Male
231 | "Rathgeber, Brent",Conservative,Alberta,48,Male
232 | "Kellway, Matthew",NDP,Ontario,48,Male
233 | "Toone, Philip",NDP,Quebec,47,Male
234 | "Allison, Dean",Conservative,Ontario,47,Male
235 | "Trottier, Bernard",Conservative,Ontario,47,Male
236 | "Blaney, Steven",Conservative,Quebec,47,Male
237 | "Bezan, James",Conservative,Manitoba,47,Male
238 | "MacKay, Peter Gordon",Conservative,Nova Scotia,47,Male
239 | "Dykstra, Richard",Conservative,Ontario,46,Male
240 | "Sandhu, Jasbir",NDP,British Columbia,46,Male
241 | "Donnelly, Fin",NDP,British Columbia,46,Male
242 | "Armstrong, Scott",Conservative,Nova Scotia,46,Male
243 | "Byrne, Gerry",Liberal,Newfoundland and Labrador,46,Male
244 | "Stewart, Kennedy",NDP,British Columbia,46,Male
245 | "Cleary, Ryan",NDP,Newfoundland and Labrador,46,Male
246 | "Côté, Raymond",NDP,Quebec,45,Male
247 | "Clarke, Rob",Conservative,Saskatchewan,45,Male
248 | "Brison, Scott",Liberal,Nova Scotia,45,Male
249 | "Butt, Brad",Conservative,Ontario,45,Male
250 | "Rickford, Greg",Conservative,Ontario,45,Male
251 | "LeBlanc, Dominic",Liberal,New Brunswick,45,Male
252 | "Hoback, Randy",Conservative,Saskatchewan,45,Male
253 | "Caron, Guy",NDP,Quebec,44,Male
254 | "Brahmi, Tarik",NDP,Quebec,44,Male
255 | "Kenney, Jason",Conservative,Alberta,44,Male
256 | "Masse, Brian",NDP,Ontario,44,Male
257 | "Alexander, Chris",Conservative,Ontario,44,Male
258 | "Zimmer, Bob",Conservative,British Columbia,44,Male
259 | "Calkins, Blaine",Conservative,Alberta,44,Male
260 | "Baird, John",Conservative,Ontario,43,Male
261 | "Lake, Mike",Conservative,Alberta,43,Male
262 | "Simms, Scott",Liberal,Newfoundland and Labrador,43,Male
263 | "Thibeault, Glenn",NDP,Ontario,43,Male
264 | "Williamson, John",Conservative,New Brunswick,42,Male
265 | "Calandra, Paul",Conservative,Ontario,42,Male
266 | "Chicoine, Sylvain",NDP,Quebec,42,Male
267 | "Del Mastro, Dean",Conservative,Ontario,42,Male
268 | "Rajotte, James",Conservative,Alberta,42,Male
269 | "Seeback, Kyle",Conservative,Ontario,42,Male
270 | "Watson, Jeff",Conservative,Ontario,41,Male
271 | "Lapointe, François",NDP,Quebec,41,Male
272 | "Nicholls, Jamie",NDP,Quebec,41,Male
273 | "Chong, Michael D.",Conservative,Ontario,41,Male
274 | "Trudeau, Justin",Liberal,Quebec,41,Male
275 | "Larose, Jean-François",NDP,Quebec,40,Male
276 | "Anders, Rob",Conservative,Alberta,40,Male
277 | "Fletcher, Steven John",Conservative,Manitoba,40,Male
278 | "Cullen, Nathan",NDP,British Columbia,40,Male
279 | "Ravignat, Mathieu",NDP,Quebec,39,Male
280 | "Bruinooge, Rod",Conservative,Manitoba,39,Male
281 | "Mai, Hoang",NDP,Quebec,39,Male
282 | "Boulerice, Alexandre",NDP,Quebec,39,Male
283 | "Fortin, Jean-François",Bloc Quebecois,Quebec,39,Male
284 | "Leef, Ryan",Conservative,Territories,38,Male
285 | "Paradis, Christian",Conservative,Quebec,38,Male
286 | "Choquette, François",NDP,Quebec,38,Male
287 | "Moore, Rob",Conservative,New Brunswick,38,Male
288 | "Trost, Brad",Conservative,Saskatchewan,38,Male
289 | "Gill, Parm",Conservative,Ontario,38,Male
290 | "Hillyer, Jim",Conservative,Alberta,38,Male
291 | "Richards, Blake",Conservative,Alberta,38,Male
292 | "Uppal, Tim",Conservative,Alberta,38,Male
293 | "Andrews, Scott",Liberal,Newfoundland and Labrador,37,Male
294 | "Moore, James",Conservative,British Columbia,36,Male
295 | "Lobb, Ben",Conservative,Ontario,36,Male
296 | "Albas, Dan",Conservative,British Columbia,36,Male
297 | "Storseth, Brian",Conservative,Alberta,34,Male
298 | "Strahl, Mark",Conservative,British Columbia,34,Male
299 | "Brown, Patrick W.",Conservative,Ontario,34,Male
300 | "Warkentin, Chris",Conservative,Alberta,34,Male
301 | "Scheer, Andrew",Conservative,Saskatchewan,33,Male
302 | "Poilievre, Pierre",Conservative,Ontario,33,Male
303 | "Genest-Jourdain, Jonathan",NDP,Quebec,33,Male
304 | "Harris, Dan",NDP,Ontario,33,Male
305 | "Tremblay, Jonathan",NDP,Quebec,28,Male
306 | "Morin, Dany",NDP,Quebec,27,Male
307 | "Dubé, Matthew",NDP,Quebec,24,Male
308 | "Dusseault, Pierre-Luc",NDP,Quebec,21,Male
309 | "O'Toole, Erin",Conservative,Ontario,,Male
310 |
--------------------------------------------------------------------------------
/ipypivot/api/create_api_json.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 1,
6 | "metadata": {},
7 | "outputs": [],
8 | "source": [
9 | "import pandas as pd"
10 | ]
11 | },
12 | {
13 | "cell_type": "code",
14 | "execution_count": 2,
15 | "metadata": {
16 | "scrolled": false
17 | },
18 | "outputs": [
19 | {
20 | "data": {
21 | "text/html": [
22 | "\n",
23 | "\n",
36 | "
\n",
37 | " \n",
38 | " \n",
39 | " | \n",
40 | " Key | \n",
41 | " Type | \n",
42 | " Default value | \n",
43 | " Description | \n",
44 | "
\n",
45 | " \n",
46 | " \n",
47 | " \n",
48 | " | 0 | \n",
49 | " rows | \n",
50 | " array of strings | \n",
51 | " [] | \n",
52 | " array of attribute names to use as rows | \n",
53 | "
\n",
54 | " \n",
55 | " | 1 | \n",
56 | " cols | \n",
57 | " array of strings | \n",
58 | " [] | \n",
59 | " array of attribute names for use as columns | \n",
60 | "
\n",
61 | " \n",
62 | " | 2 | \n",
63 | " aggregator | \n",
64 | " function | \n",
65 | " $.pivotUtilities .aggregators[\"Count\"]() | \n",
66 | " constructor for an object which will aggregate... | \n",
67 | "
\n",
68 | " \n",
69 | " | 3 | \n",
70 | " aggregatorName | \n",
71 | " string | \n",
72 | " Count | \n",
73 | " Name of the aggregator, used for display purpo... | \n",
74 | "
\n",
75 | " \n",
76 | " | 4 | \n",
77 | " renderer | \n",
78 | " function | \n",
79 | " table() | \n",
80 | " generates output from pivot data structure (se... | \n",
81 | "
\n",
82 | " \n",
83 | " | 5 | \n",
84 | " rowOrder | \n",
85 | " string | \n",
86 | " key_a_to_z | \n",
87 | " the order in which row data is provided to the... | \n",
88 | "
\n",
89 | " \n",
90 | " | 6 | \n",
91 | " colOrder | \n",
92 | " string | \n",
93 | " key_a_to_z | \n",
94 | " the order in which column data is provided to ... | \n",
95 | "
\n",
96 | " \n",
97 | " | 7 | \n",
98 | " derivedAttributes | \n",
99 | " object of functions | \n",
100 | " {} | \n",
101 | " object to define derived attributes (see docum... | \n",
102 | "
\n",
103 | " \n",
104 | " | 8 | \n",
105 | " dataClass | \n",
106 | " function | \n",
107 | " $.pivotUtilities.PivotData | \n",
108 | " Constructor for the data class to be built and... | \n",
109 | "
\n",
110 | " \n",
111 | " | 9 | \n",
112 | " filter | \n",
113 | " function | \n",
114 | " function(){return true;} | \n",
115 | " called on each record, returns false if the re... | \n",
116 | "
\n",
117 | " \n",
118 | " | 10 | \n",
119 | " sorters | \n",
120 | " object or function | \n",
121 | " {} | \n",
122 | " accessed or called with an attribute name and ... | \n",
123 | "
\n",
124 | " \n",
125 | " | 11 | \n",
126 | " rendererOptions | \n",
127 | " object | \n",
128 | " {} | \n",
129 | " object passed through to renderer as options | \n",
130 | "
\n",
131 | " \n",
132 | " | 12 | \n",
133 | " localeStrings | \n",
134 | " object | \n",
135 | " en strings | \n",
136 | " locale-specific strings for error messages (se... | \n",
137 | "
\n",
138 | " \n",
139 | "
\n",
140 | "
"
141 | ],
142 | "text/plain": [
143 | " Key Type \\\n",
144 | "0 rows array of strings \n",
145 | "1 cols array of strings \n",
146 | "2 aggregator function \n",
147 | "3 aggregatorName string \n",
148 | "4 renderer function \n",
149 | "5 rowOrder string \n",
150 | "6 colOrder string \n",
151 | "7 derivedAttributes object of functions \n",
152 | "8 dataClass function \n",
153 | "9 filter function \n",
154 | "10 sorters object or function \n",
155 | "11 rendererOptions object \n",
156 | "12 localeStrings object \n",
157 | "\n",
158 | " Default value \\\n",
159 | "0 [] \n",
160 | "1 [] \n",
161 | "2 $.pivotUtilities .aggregators[\"Count\"]() \n",
162 | "3 Count \n",
163 | "4 table() \n",
164 | "5 key_a_to_z \n",
165 | "6 key_a_to_z \n",
166 | "7 {} \n",
167 | "8 $.pivotUtilities.PivotData \n",
168 | "9 function(){return true;} \n",
169 | "10 {} \n",
170 | "11 {} \n",
171 | "12 en strings \n",
172 | "\n",
173 | " Description \n",
174 | "0 array of attribute names to use as rows \n",
175 | "1 array of attribute names for use as columns \n",
176 | "2 constructor for an object which will aggregate... \n",
177 | "3 Name of the aggregator, used for display purpo... \n",
178 | "4 generates output from pivot data structure (se... \n",
179 | "5 the order in which row data is provided to the... \n",
180 | "6 the order in which column data is provided to ... \n",
181 | "7 object to define derived attributes (see docum... \n",
182 | "8 Constructor for the data class to be built and... \n",
183 | "9 called on each record, returns false if the re... \n",
184 | "10 accessed or called with an attribute name and ... \n",
185 | "11 object passed through to renderer as options \n",
186 | "12 locale-specific strings for error messages (se... "
187 | ]
188 | },
189 | "execution_count": 2,
190 | "metadata": {},
191 | "output_type": "execute_result"
192 | }
193 | ],
194 | "source": [
195 | "df = pd.read_csv('pivot.tsv', sep='\\t')\n",
196 | "df.to_json('pivot.json', orient='records')\n",
197 | "df = pd.read_json('pivot.json', orient='records')\n",
198 | "\n",
199 | "df = df[['Key ', 'Type ', 'Default value ', 'Description']]\n",
200 | "df"
201 | ]
202 | },
203 | {
204 | "cell_type": "code",
205 | "execution_count": 3,
206 | "metadata": {},
207 | "outputs": [
208 | {
209 | "data": {
210 | "text/html": [
211 | "\n",
212 | "\n",
225 | "
\n",
226 | " \n",
227 | " \n",
228 | " | \n",
229 | " Key | \n",
230 | " Type | \n",
231 | " Default value | \n",
232 | " Description | \n",
233 | "
\n",
234 | " \n",
235 | " \n",
236 | " \n",
237 | " | 0 | \n",
238 | " rows | \n",
239 | " array of strings | \n",
240 | " [] | \n",
241 | " attribute names to prepopulate in row area | \n",
242 | "
\n",
243 | " \n",
244 | " | 1 | \n",
245 | " cols | \n",
246 | " array of strings | \n",
247 | " [] | \n",
248 | " attribute names to prepopulate in cols area | \n",
249 | "
\n",
250 | " \n",
251 | " | 2 | \n",
252 | " vals | \n",
253 | " array of strings | \n",
254 | " [] | \n",
255 | " attribute names to prepopulate in vals area (g... | \n",
256 | "
\n",
257 | " \n",
258 | " | 3 | \n",
259 | " aggregators | \n",
260 | " object of functions | \n",
261 | " $.pivotUtilities.aggregators | \n",
262 | " dictionary of generators for aggregation funct... | \n",
263 | "
\n",
264 | " \n",
265 | " | 4 | \n",
266 | " aggregatorName | \n",
267 | " string | \n",
268 | " first key in aggregators | \n",
269 | " aggregator to prepopulate in dropdown i.e. key... | \n",
270 | "
\n",
271 | " \n",
272 | " | 5 | \n",
273 | " renderers | \n",
274 | " object of functions | \n",
275 | " $.pivotUtilities.renderers | \n",
276 | " dictionary of rendering functions (see documen... | \n",
277 | "
\n",
278 | " \n",
279 | " | 6 | \n",
280 | " rendererName | \n",
281 | " string | \n",
282 | " first key in renderers | \n",
283 | " renderer to prepopulate in dropdown, i.e key t... | \n",
284 | "
\n",
285 | " \n",
286 | " | 7 | \n",
287 | " rowOrder | \n",
288 | " string | \n",
289 | " key_a_to_z | \n",
290 | " the order in which row data is provided to the... | \n",
291 | "
\n",
292 | " \n",
293 | " | 8 | \n",
294 | " colOrder | \n",
295 | " string | \n",
296 | " key_a_to_z | \n",
297 | " the order in which column data is provided to ... | \n",
298 | "
\n",
299 | " \n",
300 | " | 9 | \n",
301 | " derivedAttributes | \n",
302 | " object of functions | \n",
303 | " {} | \n",
304 | " defines derived attributes (see documentation) | \n",
305 | "
\n",
306 | " \n",
307 | " | 10 | \n",
308 | " dataClass | \n",
309 | " function | \n",
310 | " $.pivotUtilities.PivotData | \n",
311 | " Constructor for the data class to be built and... | \n",
312 | "
\n",
313 | " \n",
314 | " | 11 | \n",
315 | " filter | \n",
316 | " function | \n",
317 | " function(){return true;} | \n",
318 | " called on each record, returns false if the re... | \n",
319 | "
\n",
320 | " \n",
321 | " | 12 | \n",
322 | " inclusions | \n",
323 | " object of arrays of strings | \n",
324 | " {} | \n",
325 | " object whose keys are attribute names and valu... | \n",
326 | "
\n",
327 | " \n",
328 | " | 13 | \n",
329 | " exclusions | \n",
330 | " object of arrays of strings | \n",
331 | " {} | \n",
332 | " object whose keys are attribute names and valu... | \n",
333 | "
\n",
334 | " \n",
335 | " | 14 | \n",
336 | " hiddenAttributes | \n",
337 | " array of strings | \n",
338 | " [] | \n",
339 | " contains attribute names to omit from the UI | \n",
340 | "
\n",
341 | " \n",
342 | " | 15 | \n",
343 | " hiddenFromAggregators | \n",
344 | " array of strings | \n",
345 | " [] | \n",
346 | " contains attribute names to omit from the aggr... | \n",
347 | "
\n",
348 | " \n",
349 | " | 16 | \n",
350 | " hiddenFromDragDrop | \n",
351 | " array of strings | \n",
352 | " [] | \n",
353 | " contains attribute names to omit from the drag... | \n",
354 | "
\n",
355 | " \n",
356 | " | 17 | \n",
357 | " sorters | \n",
358 | " object or function | \n",
359 | " {} | \n",
360 | " accessed or called with an attribute name and ... | \n",
361 | "
\n",
362 | " \n",
363 | " | 18 | \n",
364 | " onRefresh | \n",
365 | " function | \n",
366 | " function(){} | \n",
367 | " called upon renderer refresh with an object re... | \n",
368 | "
\n",
369 | " \n",
370 | " | 19 | \n",
371 | " menuLimit | \n",
372 | " integer | \n",
373 | " 50 | \n",
374 | " maximum number of values to list in the double... | \n",
375 | "
\n",
376 | " \n",
377 | " | 20 | \n",
378 | " autoSortUnusedAttrs | \n",
379 | " boolean | \n",
380 | " false | \n",
381 | " controls whether or not unused attributes are ... | \n",
382 | "
\n",
383 | " \n",
384 | " | 21 | \n",
385 | " unusedAttrsVertical | \n",
386 | " boolean or integer | \n",
387 | " 85 | \n",
388 | " controls whether or not unused attributes are ... | \n",
389 | "
\n",
390 | " \n",
391 | " | 22 | \n",
392 | " rendererOptions | \n",
393 | " object | \n",
394 | " {} | \n",
395 | " passed through to renderer as options | \n",
396 | "
\n",
397 | " \n",
398 | " | 23 | \n",
399 | " localeStrings | \n",
400 | " object | \n",
401 | " en strings | \n",
402 | " locale-specific strings for UI display (see lo... | \n",
403 | "
\n",
404 | " \n",
405 | "
\n",
406 | "
"
407 | ],
408 | "text/plain": [
409 | " Key Type \\\n",
410 | "0 rows array of strings \n",
411 | "1 cols array of strings \n",
412 | "2 vals array of strings \n",
413 | "3 aggregators object of functions \n",
414 | "4 aggregatorName string \n",
415 | "5 renderers object of functions \n",
416 | "6 rendererName string \n",
417 | "7 rowOrder string \n",
418 | "8 colOrder string \n",
419 | "9 derivedAttributes object of functions \n",
420 | "10 dataClass function \n",
421 | "11 filter function \n",
422 | "12 inclusions object of arrays of strings \n",
423 | "13 exclusions object of arrays of strings \n",
424 | "14 hiddenAttributes array of strings \n",
425 | "15 hiddenFromAggregators array of strings \n",
426 | "16 hiddenFromDragDrop array of strings \n",
427 | "17 sorters object or function \n",
428 | "18 onRefresh function \n",
429 | "19 menuLimit integer \n",
430 | "20 autoSortUnusedAttrs boolean \n",
431 | "21 unusedAttrsVertical boolean or integer \n",
432 | "22 rendererOptions object \n",
433 | "23 localeStrings object \n",
434 | "\n",
435 | " Default value \\\n",
436 | "0 [] \n",
437 | "1 [] \n",
438 | "2 [] \n",
439 | "3 $.pivotUtilities.aggregators \n",
440 | "4 first key in aggregators \n",
441 | "5 $.pivotUtilities.renderers \n",
442 | "6 first key in renderers \n",
443 | "7 key_a_to_z \n",
444 | "8 key_a_to_z \n",
445 | "9 {} \n",
446 | "10 $.pivotUtilities.PivotData \n",
447 | "11 function(){return true;} \n",
448 | "12 {} \n",
449 | "13 {} \n",
450 | "14 [] \n",
451 | "15 [] \n",
452 | "16 [] \n",
453 | "17 {} \n",
454 | "18 function(){} \n",
455 | "19 50 \n",
456 | "20 false \n",
457 | "21 85 \n",
458 | "22 {} \n",
459 | "23 en strings \n",
460 | "\n",
461 | " Description \n",
462 | "0 attribute names to prepopulate in row area \n",
463 | "1 attribute names to prepopulate in cols area \n",
464 | "2 attribute names to prepopulate in vals area (g... \n",
465 | "3 dictionary of generators for aggregation funct... \n",
466 | "4 aggregator to prepopulate in dropdown i.e. key... \n",
467 | "5 dictionary of rendering functions (see documen... \n",
468 | "6 renderer to prepopulate in dropdown, i.e key t... \n",
469 | "7 the order in which row data is provided to the... \n",
470 | "8 the order in which column data is provided to ... \n",
471 | "9 defines derived attributes (see documentation) \n",
472 | "10 Constructor for the data class to be built and... \n",
473 | "11 called on each record, returns false if the re... \n",
474 | "12 object whose keys are attribute names and valu... \n",
475 | "13 object whose keys are attribute names and valu... \n",
476 | "14 contains attribute names to omit from the UI \n",
477 | "15 contains attribute names to omit from the aggr... \n",
478 | "16 contains attribute names to omit from the drag... \n",
479 | "17 accessed or called with an attribute name and ... \n",
480 | "18 called upon renderer refresh with an object re... \n",
481 | "19 maximum number of values to list in the double... \n",
482 | "20 controls whether or not unused attributes are ... \n",
483 | "21 controls whether or not unused attributes are ... \n",
484 | "22 passed through to renderer as options \n",
485 | "23 locale-specific strings for UI display (see lo... "
486 | ]
487 | },
488 | "execution_count": 3,
489 | "metadata": {},
490 | "output_type": "execute_result"
491 | }
492 | ],
493 | "source": [
494 | "df = pd.read_csv('pivotui.tsv', sep='\\t')\n",
495 | "df.to_json('pivotui.json', orient='records')\n",
496 | "df = pd.read_json('pivotui.json', orient='records')\n",
497 | "\n",
498 | "df = df[['Key ', 'Type ', 'Default value ', 'Description']]\n",
499 | "df"
500 | ]
501 | },
502 | {
503 | "cell_type": "code",
504 | "execution_count": 16,
505 | "metadata": {},
506 | "outputs": [],
507 | "source": [
508 | "# df = pd.read_csv('../data/iris.csv')\n",
509 | "# df = df.iloc[:, 1:]\n",
510 | "# df.info()\n",
511 | "# df.to_csv('../data/iris2.csv', index=None)"
512 | ]
513 | }
514 | ],
515 | "metadata": {
516 | "kernelspec": {
517 | "display_name": "Python 3",
518 | "language": "python",
519 | "name": "python3"
520 | },
521 | "language_info": {
522 | "codemirror_mode": {
523 | "name": "ipython",
524 | "version": 3
525 | },
526 | "file_extension": ".py",
527 | "mimetype": "text/x-python",
528 | "name": "python",
529 | "nbconvert_exporter": "python",
530 | "pygments_lexer": "ipython3",
531 | "version": "3.6.1"
532 | }
533 | },
534 | "nbformat": 4,
535 | "nbformat_minor": 1
536 | }
537 |
--------------------------------------------------------------------------------
/ipypivot/data/tips.json:
--------------------------------------------------------------------------------
1 | [
2 | [
3 | "row",
4 | "total_bill",
5 | "tip",
6 | "sex",
7 | "smoker",
8 | "day",
9 | "time",
10 | "size"
11 | ],
12 | [
13 | "1",
14 | 16.99,
15 | 1.01,
16 | "Female",
17 | "No",
18 | "Sun",
19 | "Dinner",
20 | 2
21 | ],
22 | [
23 | "2",
24 | 10.34,
25 | 1.66,
26 | "Male",
27 | "No",
28 | "Sun",
29 | "Dinner",
30 | 3
31 | ],
32 | [
33 | "3",
34 | 21.01,
35 | 3.5,
36 | "Male",
37 | "No",
38 | "Sun",
39 | "Dinner",
40 | 3
41 | ],
42 | [
43 | "4",
44 | 23.68,
45 | 3.31,
46 | "Male",
47 | "No",
48 | "Sun",
49 | "Dinner",
50 | 2
51 | ],
52 | [
53 | "5",
54 | 24.59,
55 | 3.61,
56 | "Female",
57 | "No",
58 | "Sun",
59 | "Dinner",
60 | 4
61 | ],
62 | [
63 | "6",
64 | 25.29,
65 | 4.71,
66 | "Male",
67 | "No",
68 | "Sun",
69 | "Dinner",
70 | 4
71 | ],
72 | [
73 | "7",
74 | 8.77,
75 | 2,
76 | "Male",
77 | "No",
78 | "Sun",
79 | "Dinner",
80 | 2
81 | ],
82 | [
83 | "8",
84 | 26.88,
85 | 3.12,
86 | "Male",
87 | "No",
88 | "Sun",
89 | "Dinner",
90 | 4
91 | ],
92 | [
93 | "9",
94 | 15.04,
95 | 1.96,
96 | "Male",
97 | "No",
98 | "Sun",
99 | "Dinner",
100 | 2
101 | ],
102 | [
103 | "10",
104 | 14.78,
105 | 3.23,
106 | "Male",
107 | "No",
108 | "Sun",
109 | "Dinner",
110 | 2
111 | ],
112 | [
113 | "11",
114 | 10.27,
115 | 1.71,
116 | "Male",
117 | "No",
118 | "Sun",
119 | "Dinner",
120 | 2
121 | ],
122 | [
123 | "12",
124 | 35.26,
125 | 5,
126 | "Female",
127 | "No",
128 | "Sun",
129 | "Dinner",
130 | 4
131 | ],
132 | [
133 | "13",
134 | 15.42,
135 | 1.57,
136 | "Male",
137 | "No",
138 | "Sun",
139 | "Dinner",
140 | 2
141 | ],
142 | [
143 | "14",
144 | 18.43,
145 | 3,
146 | "Male",
147 | "No",
148 | "Sun",
149 | "Dinner",
150 | 4
151 | ],
152 | [
153 | "15",
154 | 14.83,
155 | 3.02,
156 | "Female",
157 | "No",
158 | "Sun",
159 | "Dinner",
160 | 2
161 | ],
162 | [
163 | "16",
164 | 21.58,
165 | 3.92,
166 | "Male",
167 | "No",
168 | "Sun",
169 | "Dinner",
170 | 2
171 | ],
172 | [
173 | "17",
174 | 10.33,
175 | 1.67,
176 | "Female",
177 | "No",
178 | "Sun",
179 | "Dinner",
180 | 3
181 | ],
182 | [
183 | "18",
184 | 16.29,
185 | 3.71,
186 | "Male",
187 | "No",
188 | "Sun",
189 | "Dinner",
190 | 3
191 | ],
192 | [
193 | "19",
194 | 16.97,
195 | 3.5,
196 | "Female",
197 | "No",
198 | "Sun",
199 | "Dinner",
200 | 3
201 | ],
202 | [
203 | "20",
204 | 20.65,
205 | 3.35,
206 | "Male",
207 | "No",
208 | "Sat",
209 | "Dinner",
210 | 3
211 | ],
212 | [
213 | "21",
214 | 17.92,
215 | 4.08,
216 | "Male",
217 | "No",
218 | "Sat",
219 | "Dinner",
220 | 2
221 | ],
222 | [
223 | "22",
224 | 20.29,
225 | 2.75,
226 | "Female",
227 | "No",
228 | "Sat",
229 | "Dinner",
230 | 2
231 | ],
232 | [
233 | "23",
234 | 15.77,
235 | 2.23,
236 | "Female",
237 | "No",
238 | "Sat",
239 | "Dinner",
240 | 2
241 | ],
242 | [
243 | "24",
244 | 39.42,
245 | 7.58,
246 | "Male",
247 | "No",
248 | "Sat",
249 | "Dinner",
250 | 4
251 | ],
252 | [
253 | "25",
254 | 19.82,
255 | 3.18,
256 | "Male",
257 | "No",
258 | "Sat",
259 | "Dinner",
260 | 2
261 | ],
262 | [
263 | "26",
264 | 17.81,
265 | 2.34,
266 | "Male",
267 | "No",
268 | "Sat",
269 | "Dinner",
270 | 4
271 | ],
272 | [
273 | "27",
274 | 13.37,
275 | 2,
276 | "Male",
277 | "No",
278 | "Sat",
279 | "Dinner",
280 | 2
281 | ],
282 | [
283 | "28",
284 | 12.69,
285 | 2,
286 | "Male",
287 | "No",
288 | "Sat",
289 | "Dinner",
290 | 2
291 | ],
292 | [
293 | "29",
294 | 21.7,
295 | 4.3,
296 | "Male",
297 | "No",
298 | "Sat",
299 | "Dinner",
300 | 2
301 | ],
302 | [
303 | "30",
304 | 19.65,
305 | 3,
306 | "Female",
307 | "No",
308 | "Sat",
309 | "Dinner",
310 | 2
311 | ],
312 | [
313 | "31",
314 | 9.55,
315 | 1.45,
316 | "Male",
317 | "No",
318 | "Sat",
319 | "Dinner",
320 | 2
321 | ],
322 | [
323 | "32",
324 | 18.35,
325 | 2.5,
326 | "Male",
327 | "No",
328 | "Sat",
329 | "Dinner",
330 | 4
331 | ],
332 | [
333 | "33",
334 | 15.06,
335 | 3,
336 | "Female",
337 | "No",
338 | "Sat",
339 | "Dinner",
340 | 2
341 | ],
342 | [
343 | "34",
344 | 20.69,
345 | 2.45,
346 | "Female",
347 | "No",
348 | "Sat",
349 | "Dinner",
350 | 4
351 | ],
352 | [
353 | "35",
354 | 17.78,
355 | 3.27,
356 | "Male",
357 | "No",
358 | "Sat",
359 | "Dinner",
360 | 2
361 | ],
362 | [
363 | "36",
364 | 24.06,
365 | 3.6,
366 | "Male",
367 | "No",
368 | "Sat",
369 | "Dinner",
370 | 3
371 | ],
372 | [
373 | "37",
374 | 16.31,
375 | 2,
376 | "Male",
377 | "No",
378 | "Sat",
379 | "Dinner",
380 | 3
381 | ],
382 | [
383 | "38",
384 | 16.93,
385 | 3.07,
386 | "Female",
387 | "No",
388 | "Sat",
389 | "Dinner",
390 | 3
391 | ],
392 | [
393 | "39",
394 | 18.69,
395 | 2.31,
396 | "Male",
397 | "No",
398 | "Sat",
399 | "Dinner",
400 | 3
401 | ],
402 | [
403 | "40",
404 | 31.27,
405 | 5,
406 | "Male",
407 | "No",
408 | "Sat",
409 | "Dinner",
410 | 3
411 | ],
412 | [
413 | "41",
414 | 16.04,
415 | 2.24,
416 | "Male",
417 | "No",
418 | "Sat",
419 | "Dinner",
420 | 3
421 | ],
422 | [
423 | "42",
424 | 17.46,
425 | 2.54,
426 | "Male",
427 | "No",
428 | "Sun",
429 | "Dinner",
430 | 2
431 | ],
432 | [
433 | "43",
434 | 13.94,
435 | 3.06,
436 | "Male",
437 | "No",
438 | "Sun",
439 | "Dinner",
440 | 2
441 | ],
442 | [
443 | "44",
444 | 9.68,
445 | 1.32,
446 | "Male",
447 | "No",
448 | "Sun",
449 | "Dinner",
450 | 2
451 | ],
452 | [
453 | "45",
454 | 30.4,
455 | 5.6,
456 | "Male",
457 | "No",
458 | "Sun",
459 | "Dinner",
460 | 4
461 | ],
462 | [
463 | "46",
464 | 18.29,
465 | 3,
466 | "Male",
467 | "No",
468 | "Sun",
469 | "Dinner",
470 | 2
471 | ],
472 | [
473 | "47",
474 | 22.23,
475 | 5,
476 | "Male",
477 | "No",
478 | "Sun",
479 | "Dinner",
480 | 2
481 | ],
482 | [
483 | "48",
484 | 32.4,
485 | 6,
486 | "Male",
487 | "No",
488 | "Sun",
489 | "Dinner",
490 | 4
491 | ],
492 | [
493 | "49",
494 | 28.55,
495 | 2.05,
496 | "Male",
497 | "No",
498 | "Sun",
499 | "Dinner",
500 | 3
501 | ],
502 | [
503 | "50",
504 | 18.04,
505 | 3,
506 | "Male",
507 | "No",
508 | "Sun",
509 | "Dinner",
510 | 2
511 | ],
512 | [
513 | "51",
514 | 12.54,
515 | 2.5,
516 | "Male",
517 | "No",
518 | "Sun",
519 | "Dinner",
520 | 2
521 | ],
522 | [
523 | "52",
524 | 10.29,
525 | 2.6,
526 | "Female",
527 | "No",
528 | "Sun",
529 | "Dinner",
530 | 2
531 | ],
532 | [
533 | "53",
534 | 34.81,
535 | 5.2,
536 | "Female",
537 | "No",
538 | "Sun",
539 | "Dinner",
540 | 4
541 | ],
542 | [
543 | "54",
544 | 9.94,
545 | 1.56,
546 | "Male",
547 | "No",
548 | "Sun",
549 | "Dinner",
550 | 2
551 | ],
552 | [
553 | "55",
554 | 25.56,
555 | 4.34,
556 | "Male",
557 | "No",
558 | "Sun",
559 | "Dinner",
560 | 4
561 | ],
562 | [
563 | "56",
564 | 19.49,
565 | 3.51,
566 | "Male",
567 | "No",
568 | "Sun",
569 | "Dinner",
570 | 2
571 | ],
572 | [
573 | "57",
574 | 38.01,
575 | 3,
576 | "Male",
577 | "Yes",
578 | "Sat",
579 | "Dinner",
580 | 4
581 | ],
582 | [
583 | "58",
584 | 26.41,
585 | 1.5,
586 | "Female",
587 | "No",
588 | "Sat",
589 | "Dinner",
590 | 2
591 | ],
592 | [
593 | "59",
594 | 11.24,
595 | 1.76,
596 | "Male",
597 | "Yes",
598 | "Sat",
599 | "Dinner",
600 | 2
601 | ],
602 | [
603 | "60",
604 | 48.27,
605 | 6.73,
606 | "Male",
607 | "No",
608 | "Sat",
609 | "Dinner",
610 | 4
611 | ],
612 | [
613 | "61",
614 | 20.29,
615 | 3.21,
616 | "Male",
617 | "Yes",
618 | "Sat",
619 | "Dinner",
620 | 2
621 | ],
622 | [
623 | "62",
624 | 13.81,
625 | 2,
626 | "Male",
627 | "Yes",
628 | "Sat",
629 | "Dinner",
630 | 2
631 | ],
632 | [
633 | "63",
634 | 11.02,
635 | 1.98,
636 | "Male",
637 | "Yes",
638 | "Sat",
639 | "Dinner",
640 | 2
641 | ],
642 | [
643 | "64",
644 | 18.29,
645 | 3.76,
646 | "Male",
647 | "Yes",
648 | "Sat",
649 | "Dinner",
650 | 4
651 | ],
652 | [
653 | "65",
654 | 17.59,
655 | 2.64,
656 | "Male",
657 | "No",
658 | "Sat",
659 | "Dinner",
660 | 3
661 | ],
662 | [
663 | "66",
664 | 20.08,
665 | 3.15,
666 | "Male",
667 | "No",
668 | "Sat",
669 | "Dinner",
670 | 3
671 | ],
672 | [
673 | "67",
674 | 16.45,
675 | 2.47,
676 | "Female",
677 | "No",
678 | "Sat",
679 | "Dinner",
680 | 2
681 | ],
682 | [
683 | "68",
684 | 3.07,
685 | 1,
686 | "Female",
687 | "Yes",
688 | "Sat",
689 | "Dinner",
690 | 1
691 | ],
692 | [
693 | "69",
694 | 20.23,
695 | 2.01,
696 | "Male",
697 | "No",
698 | "Sat",
699 | "Dinner",
700 | 2
701 | ],
702 | [
703 | "70",
704 | 15.01,
705 | 2.09,
706 | "Male",
707 | "Yes",
708 | "Sat",
709 | "Dinner",
710 | 2
711 | ],
712 | [
713 | "71",
714 | 12.02,
715 | 1.97,
716 | "Male",
717 | "No",
718 | "Sat",
719 | "Dinner",
720 | 2
721 | ],
722 | [
723 | "72",
724 | 17.07,
725 | 3,
726 | "Female",
727 | "No",
728 | "Sat",
729 | "Dinner",
730 | 3
731 | ],
732 | [
733 | "73",
734 | 26.86,
735 | 3.14,
736 | "Female",
737 | "Yes",
738 | "Sat",
739 | "Dinner",
740 | 2
741 | ],
742 | [
743 | "74",
744 | 25.28,
745 | 5,
746 | "Female",
747 | "Yes",
748 | "Sat",
749 | "Dinner",
750 | 2
751 | ],
752 | [
753 | "75",
754 | 14.73,
755 | 2.2,
756 | "Female",
757 | "No",
758 | "Sat",
759 | "Dinner",
760 | 2
761 | ],
762 | [
763 | "76",
764 | 10.51,
765 | 1.25,
766 | "Male",
767 | "No",
768 | "Sat",
769 | "Dinner",
770 | 2
771 | ],
772 | [
773 | "77",
774 | 17.92,
775 | 3.08,
776 | "Male",
777 | "Yes",
778 | "Sat",
779 | "Dinner",
780 | 2
781 | ],
782 | [
783 | "78",
784 | 27.2,
785 | 4,
786 | "Male",
787 | "No",
788 | "Thur",
789 | "Lunch",
790 | 4
791 | ],
792 | [
793 | "79",
794 | 22.76,
795 | 3,
796 | "Male",
797 | "No",
798 | "Thur",
799 | "Lunch",
800 | 2
801 | ],
802 | [
803 | "80",
804 | 17.29,
805 | 2.71,
806 | "Male",
807 | "No",
808 | "Thur",
809 | "Lunch",
810 | 2
811 | ],
812 | [
813 | "81",
814 | 19.44,
815 | 3,
816 | "Male",
817 | "Yes",
818 | "Thur",
819 | "Lunch",
820 | 2
821 | ],
822 | [
823 | "82",
824 | 16.66,
825 | 3.4,
826 | "Male",
827 | "No",
828 | "Thur",
829 | "Lunch",
830 | 2
831 | ],
832 | [
833 | "83",
834 | 10.07,
835 | 1.83,
836 | "Female",
837 | "No",
838 | "Thur",
839 | "Lunch",
840 | 1
841 | ],
842 | [
843 | "84",
844 | 32.68,
845 | 5,
846 | "Male",
847 | "Yes",
848 | "Thur",
849 | "Lunch",
850 | 2
851 | ],
852 | [
853 | "85",
854 | 15.98,
855 | 2.03,
856 | "Male",
857 | "No",
858 | "Thur",
859 | "Lunch",
860 | 2
861 | ],
862 | [
863 | "86",
864 | 34.83,
865 | 5.17,
866 | "Female",
867 | "No",
868 | "Thur",
869 | "Lunch",
870 | 4
871 | ],
872 | [
873 | "87",
874 | 13.03,
875 | 2,
876 | "Male",
877 | "No",
878 | "Thur",
879 | "Lunch",
880 | 2
881 | ],
882 | [
883 | "88",
884 | 18.28,
885 | 4,
886 | "Male",
887 | "No",
888 | "Thur",
889 | "Lunch",
890 | 2
891 | ],
892 | [
893 | "89",
894 | 24.71,
895 | 5.85,
896 | "Male",
897 | "No",
898 | "Thur",
899 | "Lunch",
900 | 2
901 | ],
902 | [
903 | "90",
904 | 21.16,
905 | 3,
906 | "Male",
907 | "No",
908 | "Thur",
909 | "Lunch",
910 | 2
911 | ],
912 | [
913 | "91",
914 | 28.97,
915 | 3,
916 | "Male",
917 | "Yes",
918 | "Fri",
919 | "Dinner",
920 | 2
921 | ],
922 | [
923 | "92",
924 | 22.49,
925 | 3.5,
926 | "Male",
927 | "No",
928 | "Fri",
929 | "Dinner",
930 | 2
931 | ],
932 | [
933 | "93",
934 | 5.75,
935 | 1,
936 | "Female",
937 | "Yes",
938 | "Fri",
939 | "Dinner",
940 | 2
941 | ],
942 | [
943 | "94",
944 | 16.32,
945 | 4.3,
946 | "Female",
947 | "Yes",
948 | "Fri",
949 | "Dinner",
950 | 2
951 | ],
952 | [
953 | "95",
954 | 22.75,
955 | 3.25,
956 | "Female",
957 | "No",
958 | "Fri",
959 | "Dinner",
960 | 2
961 | ],
962 | [
963 | "96",
964 | 40.17,
965 | 4.73,
966 | "Male",
967 | "Yes",
968 | "Fri",
969 | "Dinner",
970 | 4
971 | ],
972 | [
973 | "97",
974 | 27.28,
975 | 4,
976 | "Male",
977 | "Yes",
978 | "Fri",
979 | "Dinner",
980 | 2
981 | ],
982 | [
983 | "98",
984 | 12.03,
985 | 1.5,
986 | "Male",
987 | "Yes",
988 | "Fri",
989 | "Dinner",
990 | 2
991 | ],
992 | [
993 | "99",
994 | 21.01,
995 | 3,
996 | "Male",
997 | "Yes",
998 | "Fri",
999 | "Dinner",
1000 | 2
1001 | ],
1002 | [
1003 | "100",
1004 | 12.46,
1005 | 1.5,
1006 | "Male",
1007 | "No",
1008 | "Fri",
1009 | "Dinner",
1010 | 2
1011 | ],
1012 | [
1013 | "101",
1014 | 11.35,
1015 | 2.5,
1016 | "Female",
1017 | "Yes",
1018 | "Fri",
1019 | "Dinner",
1020 | 2
1021 | ],
1022 | [
1023 | "102",
1024 | 15.38,
1025 | 3,
1026 | "Female",
1027 | "Yes",
1028 | "Fri",
1029 | "Dinner",
1030 | 2
1031 | ],
1032 | [
1033 | "103",
1034 | 44.3,
1035 | 2.5,
1036 | "Female",
1037 | "Yes",
1038 | "Sat",
1039 | "Dinner",
1040 | 3
1041 | ],
1042 | [
1043 | "104",
1044 | 22.42,
1045 | 3.48,
1046 | "Female",
1047 | "Yes",
1048 | "Sat",
1049 | "Dinner",
1050 | 2
1051 | ],
1052 | [
1053 | "105",
1054 | 20.92,
1055 | 4.08,
1056 | "Female",
1057 | "No",
1058 | "Sat",
1059 | "Dinner",
1060 | 2
1061 | ],
1062 | [
1063 | "106",
1064 | 15.36,
1065 | 1.64,
1066 | "Male",
1067 | "Yes",
1068 | "Sat",
1069 | "Dinner",
1070 | 2
1071 | ],
1072 | [
1073 | "107",
1074 | 20.49,
1075 | 4.06,
1076 | "Male",
1077 | "Yes",
1078 | "Sat",
1079 | "Dinner",
1080 | 2
1081 | ],
1082 | [
1083 | "108",
1084 | 25.21,
1085 | 4.29,
1086 | "Male",
1087 | "Yes",
1088 | "Sat",
1089 | "Dinner",
1090 | 2
1091 | ],
1092 | [
1093 | "109",
1094 | 18.24,
1095 | 3.76,
1096 | "Male",
1097 | "No",
1098 | "Sat",
1099 | "Dinner",
1100 | 2
1101 | ],
1102 | [
1103 | "110",
1104 | 14.31,
1105 | 4,
1106 | "Female",
1107 | "Yes",
1108 | "Sat",
1109 | "Dinner",
1110 | 2
1111 | ],
1112 | [
1113 | "111",
1114 | 14,
1115 | 3,
1116 | "Male",
1117 | "No",
1118 | "Sat",
1119 | "Dinner",
1120 | 2
1121 | ],
1122 | [
1123 | "112",
1124 | 7.25,
1125 | 1,
1126 | "Female",
1127 | "No",
1128 | "Sat",
1129 | "Dinner",
1130 | 1
1131 | ],
1132 | [
1133 | "113",
1134 | 38.07,
1135 | 4,
1136 | "Male",
1137 | "No",
1138 | "Sun",
1139 | "Dinner",
1140 | 3
1141 | ],
1142 | [
1143 | "114",
1144 | 23.95,
1145 | 2.55,
1146 | "Male",
1147 | "No",
1148 | "Sun",
1149 | "Dinner",
1150 | 2
1151 | ],
1152 | [
1153 | "115",
1154 | 25.71,
1155 | 4,
1156 | "Female",
1157 | "No",
1158 | "Sun",
1159 | "Dinner",
1160 | 3
1161 | ],
1162 | [
1163 | "116",
1164 | 17.31,
1165 | 3.5,
1166 | "Female",
1167 | "No",
1168 | "Sun",
1169 | "Dinner",
1170 | 2
1171 | ],
1172 | [
1173 | "117",
1174 | 29.93,
1175 | 5.07,
1176 | "Male",
1177 | "No",
1178 | "Sun",
1179 | "Dinner",
1180 | 4
1181 | ],
1182 | [
1183 | "118",
1184 | 10.65,
1185 | 1.5,
1186 | "Female",
1187 | "No",
1188 | "Thur",
1189 | "Lunch",
1190 | 2
1191 | ],
1192 | [
1193 | "119",
1194 | 12.43,
1195 | 1.8,
1196 | "Female",
1197 | "No",
1198 | "Thur",
1199 | "Lunch",
1200 | 2
1201 | ],
1202 | [
1203 | "120",
1204 | 24.08,
1205 | 2.92,
1206 | "Female",
1207 | "No",
1208 | "Thur",
1209 | "Lunch",
1210 | 4
1211 | ],
1212 | [
1213 | "121",
1214 | 11.69,
1215 | 2.31,
1216 | "Male",
1217 | "No",
1218 | "Thur",
1219 | "Lunch",
1220 | 2
1221 | ],
1222 | [
1223 | "122",
1224 | 13.42,
1225 | 1.68,
1226 | "Female",
1227 | "No",
1228 | "Thur",
1229 | "Lunch",
1230 | 2
1231 | ],
1232 | [
1233 | "123",
1234 | 14.26,
1235 | 2.5,
1236 | "Male",
1237 | "No",
1238 | "Thur",
1239 | "Lunch",
1240 | 2
1241 | ],
1242 | [
1243 | "124",
1244 | 15.95,
1245 | 2,
1246 | "Male",
1247 | "No",
1248 | "Thur",
1249 | "Lunch",
1250 | 2
1251 | ],
1252 | [
1253 | "125",
1254 | 12.48,
1255 | 2.52,
1256 | "Female",
1257 | "No",
1258 | "Thur",
1259 | "Lunch",
1260 | 2
1261 | ],
1262 | [
1263 | "126",
1264 | 29.8,
1265 | 4.2,
1266 | "Female",
1267 | "No",
1268 | "Thur",
1269 | "Lunch",
1270 | 6
1271 | ],
1272 | [
1273 | "127",
1274 | 8.52,
1275 | 1.48,
1276 | "Male",
1277 | "No",
1278 | "Thur",
1279 | "Lunch",
1280 | 2
1281 | ],
1282 | [
1283 | "128",
1284 | 14.52,
1285 | 2,
1286 | "Female",
1287 | "No",
1288 | "Thur",
1289 | "Lunch",
1290 | 2
1291 | ],
1292 | [
1293 | "129",
1294 | 11.38,
1295 | 2,
1296 | "Female",
1297 | "No",
1298 | "Thur",
1299 | "Lunch",
1300 | 2
1301 | ],
1302 | [
1303 | "130",
1304 | 22.82,
1305 | 2.18,
1306 | "Male",
1307 | "No",
1308 | "Thur",
1309 | "Lunch",
1310 | 3
1311 | ],
1312 | [
1313 | "131",
1314 | 19.08,
1315 | 1.5,
1316 | "Male",
1317 | "No",
1318 | "Thur",
1319 | "Lunch",
1320 | 2
1321 | ],
1322 | [
1323 | "132",
1324 | 20.27,
1325 | 2.83,
1326 | "Female",
1327 | "No",
1328 | "Thur",
1329 | "Lunch",
1330 | 2
1331 | ],
1332 | [
1333 | "133",
1334 | 11.17,
1335 | 1.5,
1336 | "Female",
1337 | "No",
1338 | "Thur",
1339 | "Lunch",
1340 | 2
1341 | ],
1342 | [
1343 | "134",
1344 | 12.26,
1345 | 2,
1346 | "Female",
1347 | "No",
1348 | "Thur",
1349 | "Lunch",
1350 | 2
1351 | ],
1352 | [
1353 | "135",
1354 | 18.26,
1355 | 3.25,
1356 | "Female",
1357 | "No",
1358 | "Thur",
1359 | "Lunch",
1360 | 2
1361 | ],
1362 | [
1363 | "136",
1364 | 8.51,
1365 | 1.25,
1366 | "Female",
1367 | "No",
1368 | "Thur",
1369 | "Lunch",
1370 | 2
1371 | ],
1372 | [
1373 | "137",
1374 | 10.33,
1375 | 2,
1376 | "Female",
1377 | "No",
1378 | "Thur",
1379 | "Lunch",
1380 | 2
1381 | ],
1382 | [
1383 | "138",
1384 | 14.15,
1385 | 2,
1386 | "Female",
1387 | "No",
1388 | "Thur",
1389 | "Lunch",
1390 | 2
1391 | ],
1392 | [
1393 | "139",
1394 | 16,
1395 | 2,
1396 | "Male",
1397 | "Yes",
1398 | "Thur",
1399 | "Lunch",
1400 | 2
1401 | ],
1402 | [
1403 | "140",
1404 | 13.16,
1405 | 2.75,
1406 | "Female",
1407 | "No",
1408 | "Thur",
1409 | "Lunch",
1410 | 2
1411 | ],
1412 | [
1413 | "141",
1414 | 17.47,
1415 | 3.5,
1416 | "Female",
1417 | "No",
1418 | "Thur",
1419 | "Lunch",
1420 | 2
1421 | ],
1422 | [
1423 | "142",
1424 | 34.3,
1425 | 6.7,
1426 | "Male",
1427 | "No",
1428 | "Thur",
1429 | "Lunch",
1430 | 6
1431 | ],
1432 | [
1433 | "143",
1434 | 41.19,
1435 | 5,
1436 | "Male",
1437 | "No",
1438 | "Thur",
1439 | "Lunch",
1440 | 5
1441 | ],
1442 | [
1443 | "144",
1444 | 27.05,
1445 | 5,
1446 | "Female",
1447 | "No",
1448 | "Thur",
1449 | "Lunch",
1450 | 6
1451 | ],
1452 | [
1453 | "145",
1454 | 16.43,
1455 | 2.3,
1456 | "Female",
1457 | "No",
1458 | "Thur",
1459 | "Lunch",
1460 | 2
1461 | ],
1462 | [
1463 | "146",
1464 | 8.35,
1465 | 1.5,
1466 | "Female",
1467 | "No",
1468 | "Thur",
1469 | "Lunch",
1470 | 2
1471 | ],
1472 | [
1473 | "147",
1474 | 18.64,
1475 | 1.36,
1476 | "Female",
1477 | "No",
1478 | "Thur",
1479 | "Lunch",
1480 | 3
1481 | ],
1482 | [
1483 | "148",
1484 | 11.87,
1485 | 1.63,
1486 | "Female",
1487 | "No",
1488 | "Thur",
1489 | "Lunch",
1490 | 2
1491 | ],
1492 | [
1493 | "149",
1494 | 9.78,
1495 | 1.73,
1496 | "Male",
1497 | "No",
1498 | "Thur",
1499 | "Lunch",
1500 | 2
1501 | ],
1502 | [
1503 | "150",
1504 | 7.51,
1505 | 2,
1506 | "Male",
1507 | "No",
1508 | "Thur",
1509 | "Lunch",
1510 | 2
1511 | ],
1512 | [
1513 | "151",
1514 | 14.07,
1515 | 2.5,
1516 | "Male",
1517 | "No",
1518 | "Sun",
1519 | "Dinner",
1520 | 2
1521 | ],
1522 | [
1523 | "152",
1524 | 13.13,
1525 | 2,
1526 | "Male",
1527 | "No",
1528 | "Sun",
1529 | "Dinner",
1530 | 2
1531 | ],
1532 | [
1533 | "153",
1534 | 17.26,
1535 | 2.74,
1536 | "Male",
1537 | "No",
1538 | "Sun",
1539 | "Dinner",
1540 | 3
1541 | ],
1542 | [
1543 | "154",
1544 | 24.55,
1545 | 2,
1546 | "Male",
1547 | "No",
1548 | "Sun",
1549 | "Dinner",
1550 | 4
1551 | ],
1552 | [
1553 | "155",
1554 | 19.77,
1555 | 2,
1556 | "Male",
1557 | "No",
1558 | "Sun",
1559 | "Dinner",
1560 | 4
1561 | ],
1562 | [
1563 | "156",
1564 | 29.85,
1565 | 5.14,
1566 | "Female",
1567 | "No",
1568 | "Sun",
1569 | "Dinner",
1570 | 5
1571 | ],
1572 | [
1573 | "157",
1574 | 48.17,
1575 | 5,
1576 | "Male",
1577 | "No",
1578 | "Sun",
1579 | "Dinner",
1580 | 6
1581 | ],
1582 | [
1583 | "158",
1584 | 25,
1585 | 3.75,
1586 | "Female",
1587 | "No",
1588 | "Sun",
1589 | "Dinner",
1590 | 4
1591 | ],
1592 | [
1593 | "159",
1594 | 13.39,
1595 | 2.61,
1596 | "Female",
1597 | "No",
1598 | "Sun",
1599 | "Dinner",
1600 | 2
1601 | ],
1602 | [
1603 | "160",
1604 | 16.49,
1605 | 2,
1606 | "Male",
1607 | "No",
1608 | "Sun",
1609 | "Dinner",
1610 | 4
1611 | ],
1612 | [
1613 | "161",
1614 | 21.5,
1615 | 3.5,
1616 | "Male",
1617 | "No",
1618 | "Sun",
1619 | "Dinner",
1620 | 4
1621 | ],
1622 | [
1623 | "162",
1624 | 12.66,
1625 | 2.5,
1626 | "Male",
1627 | "No",
1628 | "Sun",
1629 | "Dinner",
1630 | 2
1631 | ],
1632 | [
1633 | "163",
1634 | 16.21,
1635 | 2,
1636 | "Female",
1637 | "No",
1638 | "Sun",
1639 | "Dinner",
1640 | 3
1641 | ],
1642 | [
1643 | "164",
1644 | 13.81,
1645 | 2,
1646 | "Male",
1647 | "No",
1648 | "Sun",
1649 | "Dinner",
1650 | 2
1651 | ],
1652 | [
1653 | "165",
1654 | 17.51,
1655 | 3,
1656 | "Female",
1657 | "Yes",
1658 | "Sun",
1659 | "Dinner",
1660 | 2
1661 | ],
1662 | [
1663 | "166",
1664 | 24.52,
1665 | 3.48,
1666 | "Male",
1667 | "No",
1668 | "Sun",
1669 | "Dinner",
1670 | 3
1671 | ],
1672 | [
1673 | "167",
1674 | 20.76,
1675 | 2.24,
1676 | "Male",
1677 | "No",
1678 | "Sun",
1679 | "Dinner",
1680 | 2
1681 | ],
1682 | [
1683 | "168",
1684 | 31.71,
1685 | 4.5,
1686 | "Male",
1687 | "No",
1688 | "Sun",
1689 | "Dinner",
1690 | 4
1691 | ],
1692 | [
1693 | "169",
1694 | 10.59,
1695 | 1.61,
1696 | "Female",
1697 | "Yes",
1698 | "Sat",
1699 | "Dinner",
1700 | 2
1701 | ],
1702 | [
1703 | "170",
1704 | 10.63,
1705 | 2,
1706 | "Female",
1707 | "Yes",
1708 | "Sat",
1709 | "Dinner",
1710 | 2
1711 | ],
1712 | [
1713 | "171",
1714 | 50.81,
1715 | 10,
1716 | "Male",
1717 | "Yes",
1718 | "Sat",
1719 | "Dinner",
1720 | 3
1721 | ],
1722 | [
1723 | "172",
1724 | 15.81,
1725 | 3.16,
1726 | "Male",
1727 | "Yes",
1728 | "Sat",
1729 | "Dinner",
1730 | 2
1731 | ],
1732 | [
1733 | "173",
1734 | 7.25,
1735 | 5.15,
1736 | "Male",
1737 | "Yes",
1738 | "Sun",
1739 | "Dinner",
1740 | 2
1741 | ],
1742 | [
1743 | "174",
1744 | 31.85,
1745 | 3.18,
1746 | "Male",
1747 | "Yes",
1748 | "Sun",
1749 | "Dinner",
1750 | 2
1751 | ],
1752 | [
1753 | "175",
1754 | 16.82,
1755 | 4,
1756 | "Male",
1757 | "Yes",
1758 | "Sun",
1759 | "Dinner",
1760 | 2
1761 | ],
1762 | [
1763 | "176",
1764 | 32.9,
1765 | 3.11,
1766 | "Male",
1767 | "Yes",
1768 | "Sun",
1769 | "Dinner",
1770 | 2
1771 | ],
1772 | [
1773 | "177",
1774 | 17.89,
1775 | 2,
1776 | "Male",
1777 | "Yes",
1778 | "Sun",
1779 | "Dinner",
1780 | 2
1781 | ],
1782 | [
1783 | "178",
1784 | 14.48,
1785 | 2,
1786 | "Male",
1787 | "Yes",
1788 | "Sun",
1789 | "Dinner",
1790 | 2
1791 | ],
1792 | [
1793 | "179",
1794 | 9.6,
1795 | 4,
1796 | "Female",
1797 | "Yes",
1798 | "Sun",
1799 | "Dinner",
1800 | 2
1801 | ],
1802 | [
1803 | "180",
1804 | 34.63,
1805 | 3.55,
1806 | "Male",
1807 | "Yes",
1808 | "Sun",
1809 | "Dinner",
1810 | 2
1811 | ],
1812 | [
1813 | "181",
1814 | 34.65,
1815 | 3.68,
1816 | "Male",
1817 | "Yes",
1818 | "Sun",
1819 | "Dinner",
1820 | 4
1821 | ],
1822 | [
1823 | "182",
1824 | 23.33,
1825 | 5.65,
1826 | "Male",
1827 | "Yes",
1828 | "Sun",
1829 | "Dinner",
1830 | 2
1831 | ],
1832 | [
1833 | "183",
1834 | 45.35,
1835 | 3.5,
1836 | "Male",
1837 | "Yes",
1838 | "Sun",
1839 | "Dinner",
1840 | 3
1841 | ],
1842 | [
1843 | "184",
1844 | 23.17,
1845 | 6.5,
1846 | "Male",
1847 | "Yes",
1848 | "Sun",
1849 | "Dinner",
1850 | 4
1851 | ],
1852 | [
1853 | "185",
1854 | 40.55,
1855 | 3,
1856 | "Male",
1857 | "Yes",
1858 | "Sun",
1859 | "Dinner",
1860 | 2
1861 | ],
1862 | [
1863 | "186",
1864 | 20.69,
1865 | 5,
1866 | "Male",
1867 | "No",
1868 | "Sun",
1869 | "Dinner",
1870 | 5
1871 | ],
1872 | [
1873 | "187",
1874 | 20.9,
1875 | 3.5,
1876 | "Female",
1877 | "Yes",
1878 | "Sun",
1879 | "Dinner",
1880 | 3
1881 | ],
1882 | [
1883 | "188",
1884 | 30.46,
1885 | 2,
1886 | "Male",
1887 | "Yes",
1888 | "Sun",
1889 | "Dinner",
1890 | 5
1891 | ],
1892 | [
1893 | "189",
1894 | 18.15,
1895 | 3.5,
1896 | "Female",
1897 | "Yes",
1898 | "Sun",
1899 | "Dinner",
1900 | 3
1901 | ],
1902 | [
1903 | "190",
1904 | 23.1,
1905 | 4,
1906 | "Male",
1907 | "Yes",
1908 | "Sun",
1909 | "Dinner",
1910 | 3
1911 | ],
1912 | [
1913 | "191",
1914 | 15.69,
1915 | 1.5,
1916 | "Male",
1917 | "Yes",
1918 | "Sun",
1919 | "Dinner",
1920 | 2
1921 | ],
1922 | [
1923 | "192",
1924 | 19.81,
1925 | 4.19,
1926 | "Female",
1927 | "Yes",
1928 | "Thur",
1929 | "Lunch",
1930 | 2
1931 | ],
1932 | [
1933 | "193",
1934 | 28.44,
1935 | 2.56,
1936 | "Male",
1937 | "Yes",
1938 | "Thur",
1939 | "Lunch",
1940 | 2
1941 | ],
1942 | [
1943 | "194",
1944 | 15.48,
1945 | 2.02,
1946 | "Male",
1947 | "Yes",
1948 | "Thur",
1949 | "Lunch",
1950 | 2
1951 | ],
1952 | [
1953 | "195",
1954 | 16.58,
1955 | 4,
1956 | "Male",
1957 | "Yes",
1958 | "Thur",
1959 | "Lunch",
1960 | 2
1961 | ],
1962 | [
1963 | "196",
1964 | 7.56,
1965 | 1.44,
1966 | "Male",
1967 | "No",
1968 | "Thur",
1969 | "Lunch",
1970 | 2
1971 | ],
1972 | [
1973 | "197",
1974 | 10.34,
1975 | 2,
1976 | "Male",
1977 | "Yes",
1978 | "Thur",
1979 | "Lunch",
1980 | 2
1981 | ],
1982 | [
1983 | "198",
1984 | 43.11,
1985 | 5,
1986 | "Female",
1987 | "Yes",
1988 | "Thur",
1989 | "Lunch",
1990 | 4
1991 | ],
1992 | [
1993 | "199",
1994 | 13,
1995 | 2,
1996 | "Female",
1997 | "Yes",
1998 | "Thur",
1999 | "Lunch",
2000 | 2
2001 | ],
2002 | [
2003 | "200",
2004 | 13.51,
2005 | 2,
2006 | "Male",
2007 | "Yes",
2008 | "Thur",
2009 | "Lunch",
2010 | 2
2011 | ],
2012 | [
2013 | "201",
2014 | 18.71,
2015 | 4,
2016 | "Male",
2017 | "Yes",
2018 | "Thur",
2019 | "Lunch",
2020 | 3
2021 | ],
2022 | [
2023 | "202",
2024 | 12.74,
2025 | 2.01,
2026 | "Female",
2027 | "Yes",
2028 | "Thur",
2029 | "Lunch",
2030 | 2
2031 | ],
2032 | [
2033 | "203",
2034 | 13,
2035 | 2,
2036 | "Female",
2037 | "Yes",
2038 | "Thur",
2039 | "Lunch",
2040 | 2
2041 | ],
2042 | [
2043 | "204",
2044 | 16.4,
2045 | 2.5,
2046 | "Female",
2047 | "Yes",
2048 | "Thur",
2049 | "Lunch",
2050 | 2
2051 | ],
2052 | [
2053 | "205",
2054 | 20.53,
2055 | 4,
2056 | "Male",
2057 | "Yes",
2058 | "Thur",
2059 | "Lunch",
2060 | 4
2061 | ],
2062 | [
2063 | "206",
2064 | 16.47,
2065 | 3.23,
2066 | "Female",
2067 | "Yes",
2068 | "Thur",
2069 | "Lunch",
2070 | 3
2071 | ],
2072 | [
2073 | "207",
2074 | 26.59,
2075 | 3.41,
2076 | "Male",
2077 | "Yes",
2078 | "Sat",
2079 | "Dinner",
2080 | 3
2081 | ],
2082 | [
2083 | "208",
2084 | 38.73,
2085 | 3,
2086 | "Male",
2087 | "Yes",
2088 | "Sat",
2089 | "Dinner",
2090 | 4
2091 | ],
2092 | [
2093 | "209",
2094 | 24.27,
2095 | 2.03,
2096 | "Male",
2097 | "Yes",
2098 | "Sat",
2099 | "Dinner",
2100 | 2
2101 | ],
2102 | [
2103 | "210",
2104 | 12.76,
2105 | 2.23,
2106 | "Female",
2107 | "Yes",
2108 | "Sat",
2109 | "Dinner",
2110 | 2
2111 | ],
2112 | [
2113 | "211",
2114 | 30.06,
2115 | 2,
2116 | "Male",
2117 | "Yes",
2118 | "Sat",
2119 | "Dinner",
2120 | 3
2121 | ],
2122 | [
2123 | "212",
2124 | 25.89,
2125 | 5.16,
2126 | "Male",
2127 | "Yes",
2128 | "Sat",
2129 | "Dinner",
2130 | 4
2131 | ],
2132 | [
2133 | "213",
2134 | 48.33,
2135 | 9,
2136 | "Male",
2137 | "No",
2138 | "Sat",
2139 | "Dinner",
2140 | 4
2141 | ],
2142 | [
2143 | "214",
2144 | 13.27,
2145 | 2.5,
2146 | "Female",
2147 | "Yes",
2148 | "Sat",
2149 | "Dinner",
2150 | 2
2151 | ],
2152 | [
2153 | "215",
2154 | 28.17,
2155 | 6.5,
2156 | "Female",
2157 | "Yes",
2158 | "Sat",
2159 | "Dinner",
2160 | 3
2161 | ],
2162 | [
2163 | "216",
2164 | 12.9,
2165 | 1.1,
2166 | "Female",
2167 | "Yes",
2168 | "Sat",
2169 | "Dinner",
2170 | 2
2171 | ],
2172 | [
2173 | "217",
2174 | 28.15,
2175 | 3,
2176 | "Male",
2177 | "Yes",
2178 | "Sat",
2179 | "Dinner",
2180 | 5
2181 | ],
2182 | [
2183 | "218",
2184 | 11.59,
2185 | 1.5,
2186 | "Male",
2187 | "Yes",
2188 | "Sat",
2189 | "Dinner",
2190 | 2
2191 | ],
2192 | [
2193 | "219",
2194 | 7.74,
2195 | 1.44,
2196 | "Male",
2197 | "Yes",
2198 | "Sat",
2199 | "Dinner",
2200 | 2
2201 | ],
2202 | [
2203 | "220",
2204 | 30.14,
2205 | 3.09,
2206 | "Female",
2207 | "Yes",
2208 | "Sat",
2209 | "Dinner",
2210 | 4
2211 | ],
2212 | [
2213 | "221",
2214 | 12.16,
2215 | 2.2,
2216 | "Male",
2217 | "Yes",
2218 | "Fri",
2219 | "Lunch",
2220 | 2
2221 | ],
2222 | [
2223 | "222",
2224 | 13.42,
2225 | 3.48,
2226 | "Female",
2227 | "Yes",
2228 | "Fri",
2229 | "Lunch",
2230 | 2
2231 | ],
2232 | [
2233 | "223",
2234 | 8.58,
2235 | 1.92,
2236 | "Male",
2237 | "Yes",
2238 | "Fri",
2239 | "Lunch",
2240 | 1
2241 | ],
2242 | [
2243 | "224",
2244 | 15.98,
2245 | 3,
2246 | "Female",
2247 | "No",
2248 | "Fri",
2249 | "Lunch",
2250 | 3
2251 | ],
2252 | [
2253 | "225",
2254 | 13.42,
2255 | 1.58,
2256 | "Male",
2257 | "Yes",
2258 | "Fri",
2259 | "Lunch",
2260 | 2
2261 | ],
2262 | [
2263 | "226",
2264 | 16.27,
2265 | 2.5,
2266 | "Female",
2267 | "Yes",
2268 | "Fri",
2269 | "Lunch",
2270 | 2
2271 | ],
2272 | [
2273 | "227",
2274 | 10.09,
2275 | 2,
2276 | "Female",
2277 | "Yes",
2278 | "Fri",
2279 | "Lunch",
2280 | 2
2281 | ],
2282 | [
2283 | "228",
2284 | 20.45,
2285 | 3,
2286 | "Male",
2287 | "No",
2288 | "Sat",
2289 | "Dinner",
2290 | 4
2291 | ],
2292 | [
2293 | "229",
2294 | 13.28,
2295 | 2.72,
2296 | "Male",
2297 | "No",
2298 | "Sat",
2299 | "Dinner",
2300 | 2
2301 | ],
2302 | [
2303 | "230",
2304 | 22.12,
2305 | 2.88,
2306 | "Female",
2307 | "Yes",
2308 | "Sat",
2309 | "Dinner",
2310 | 2
2311 | ],
2312 | [
2313 | "231",
2314 | 24.01,
2315 | 2,
2316 | "Male",
2317 | "Yes",
2318 | "Sat",
2319 | "Dinner",
2320 | 4
2321 | ],
2322 | [
2323 | "232",
2324 | 15.69,
2325 | 3,
2326 | "Male",
2327 | "Yes",
2328 | "Sat",
2329 | "Dinner",
2330 | 3
2331 | ],
2332 | [
2333 | "233",
2334 | 11.61,
2335 | 3.39,
2336 | "Male",
2337 | "No",
2338 | "Sat",
2339 | "Dinner",
2340 | 2
2341 | ],
2342 | [
2343 | "234",
2344 | 10.77,
2345 | 1.47,
2346 | "Male",
2347 | "No",
2348 | "Sat",
2349 | "Dinner",
2350 | 2
2351 | ],
2352 | [
2353 | "235",
2354 | 15.53,
2355 | 3,
2356 | "Male",
2357 | "Yes",
2358 | "Sat",
2359 | "Dinner",
2360 | 2
2361 | ],
2362 | [
2363 | "236",
2364 | 10.07,
2365 | 1.25,
2366 | "Male",
2367 | "No",
2368 | "Sat",
2369 | "Dinner",
2370 | 2
2371 | ],
2372 | [
2373 | "237",
2374 | 12.6,
2375 | 1,
2376 | "Male",
2377 | "Yes",
2378 | "Sat",
2379 | "Dinner",
2380 | 2
2381 | ],
2382 | [
2383 | "238",
2384 | 32.83,
2385 | 1.17,
2386 | "Male",
2387 | "Yes",
2388 | "Sat",
2389 | "Dinner",
2390 | 2
2391 | ],
2392 | [
2393 | "239",
2394 | 35.83,
2395 | 4.67,
2396 | "Female",
2397 | "No",
2398 | "Sat",
2399 | "Dinner",
2400 | 3
2401 | ],
2402 | [
2403 | "240",
2404 | 29.03,
2405 | 5.92,
2406 | "Male",
2407 | "No",
2408 | "Sat",
2409 | "Dinner",
2410 | 3
2411 | ],
2412 | [
2413 | "241",
2414 | 27.18,
2415 | 2,
2416 | "Female",
2417 | "Yes",
2418 | "Sat",
2419 | "Dinner",
2420 | 2
2421 | ],
2422 | [
2423 | "242",
2424 | 22.67,
2425 | 2,
2426 | "Male",
2427 | "Yes",
2428 | "Sat",
2429 | "Dinner",
2430 | 2
2431 | ],
2432 | [
2433 | "243",
2434 | 17.82,
2435 | 1.75,
2436 | "Male",
2437 | "No",
2438 | "Sat",
2439 | "Dinner",
2440 | 2
2441 | ],
2442 | [
2443 | "244",
2444 | 18.78,
2445 | 3,
2446 | "Female",
2447 | "No",
2448 | "Thur",
2449 | "Dinner",
2450 | 2
2451 | ]
2452 | ]
--------------------------------------------------------------------------------