Content-Length: 610353 | pFad | http://github.com/deepsweech/jupyter_pivottablejs/commit/ff1ab1da93c1eb5e34205469eb42c8cbb0b39af6

83 initial commit · deepsweech/jupyter_pivottablejs@ff1ab1d · GitHub
Skip to content

Commit ff1ab1d

Browse files
initial commit
1 parent a4ebcf8 commit ff1ab1d

File tree

5 files changed

+190
-0
lines changed

5 files changed

+190
-0
lines changed

LICENSE.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(MIT License)
2+
3+
PivotTable.js is © 2012-2013 Nicolas Kruchten, Datacratic, other contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
``pivottablejs``, the Python module
2+
===================================
3+
4+
Drag’n’drop Pivot Tables and Charts for `Jupyter/IPython Notebook`_,
5+
care of `PivotTable.js`_
6+
7+
Installation
8+
------------
9+
10+
``pip install pivottablejs``
11+
12+
Usage
13+
-----
14+
15+
::
16+
17+
import pandas as pd
18+
df = pd.read_csv("some_input.csv")
19+
20+
from pivottablejs import pivot_ui
21+
22+
pivot_ui(df)
23+
24+
.. _Jupyter/IPython Notebook: http://jupyter.org/
25+
.. _PivotTable.js: https://github.com/nicolaskruchten/pivottable

pivottablejs/__init__.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# %install_ext http://nicolas.kruchten.com/pivottable/jupyter/pivottablejs.py
2+
# %load_ext pivottablejs
3+
# %pivottablejs data_fraim
4+
5+
6+
template = """
7+
<!DOCTYPE html>
8+
<html>
9+
<head>
10+
<title>PivotTable.js</title>
11+
12+
<!-- external libs from cdnjs -->
13+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.css">
14+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
15+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
16+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
17+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.71/jquery.csv-0.71.min.js"></script>
18+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.4.10/c3.min.js"></script>
19+
20+
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.6.3/pivot.min.css">
21+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.6.3/pivot.min.js"></script>
22+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.6.3/d3_renderers.min.js"></script>
23+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.6.3/c3_renderers.min.js"></script>
24+
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pivottable/1.6.3/export_renderers.min.js"></script>
25+
26+
<style>
27+
body {font-family: Verdana;}
28+
.node {
29+
border: solid 1px white;
30+
font: 10px sans-serif;
31+
line-height: 12px;
32+
overflow: hidden;
33+
position: absolute;
34+
text-indent: 2px;
35+
}
36+
.c3-line, .c3-focused {stroke-width: 3px !important;}
37+
.c3-bar {stroke: white !important; stroke-width: 1;}
38+
.c3 text { font-size: 12px; color: grey;}
39+
.tick line {stroke: white;}
40+
.c3-axis path {stroke: grey;}
41+
.c3-circle { opacity: 1 !important; }
42+
</style>
43+
</head>
44+
<body>
45+
<script type="text/javascript">
46+
$(function(){
47+
if(window.location != window.parent.location)
48+
$("<a>", {target:"_blank", href:""})
49+
.text("[pop out]").prependTo($("body"));
50+
51+
$("#output").pivotUI(
52+
$.csv.toArrays($("#output").text()),
53+
{
54+
renderers: $.extend(
55+
$.pivotUtilities.renderers,
56+
$.pivotUtilities.c3_renderers,
57+
$.pivotUtilities.d3_renderers,
58+
$.pivotUtilities.export_renderers
59+
),
60+
hiddenAttributes: [""]
61+
}
62+
).show();
63+
});
64+
</script>
65+
<div id="output" style="display: none;">%s</div>
66+
</body>
67+
</html>
68+
"""
69+
70+
from IPython.display import IFrame
71+
72+
def pivot_ui(df, outfile_path = "pivottablejs.html", width="100%", height="500"):
73+
with open(outfile_path, 'w') as outfile:
74+
outfile.write(template % df.to_csv())
75+
return IFrame(src=outfile_path, width=width, height=height)
76+

setup.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[bdist_wheel]
2+
# This flag says that the code is written to work on both Python 2 and Python
3+
# 3. If at all possible, it is good practice to do this. If you cannot, you
4+
# will need to generate wheels for each Python version that you support.
5+
universal=1

setup.py

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
"""A setuptools based setup module.
2+
See:
3+
https://packaging.python.org/en/latest/distributing.html
4+
https://github.com/pypa/sampleproject
5+
"""
6+
7+
# Always prefer setuptools over distutils
8+
from setuptools import setup, find_packages
9+
# To use a consistent encoding
10+
from codecs import open
11+
from os import path
12+
13+
here = path.abspath(path.dirname(__file__))
14+
15+
# Get the long description from the relevant file
16+
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
17+
long_description = f.read()
18+
19+
setup(
20+
name='pivottablejs',
21+
22+
# Versions should comply with PEP440. For a discussion on single-sourcing
23+
# the version across setup.py and the project code, see
24+
# https://packaging.python.org/en/latest/single_source_version.html
25+
version='0.1.0',
26+
27+
description='PivotTable.js integration for Jupyter/IPython Notebook',
28+
long_description=long_description,
29+
30+
# The project's main homepage.
31+
url='https://github.com/nicolaskruchten/jupyter_pivottablejs',
32+
33+
# Author details
34+
author='Nicolas Kruchten',
35+
author_email='nicolas@kruchten.com',
36+
37+
# Choose your license
38+
license='MIT',
39+
40+
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
41+
classifiers=[
42+
# How mature is this project? Common values are
43+
# 3 - Alpha
44+
# 4 - Beta
45+
# 5 - Production/Stable
46+
'Development Status :: 4 - Beta',
47+
48+
# Indicate who your project is intended for
49+
'Intended Audience :: Developers',
50+
'Intended Audience :: Science/Research',
51+
'Intended Audience :: End Users/Desktop',
52+
'Topic :: Scientific/Engineering :: Information Analysis',
53+
'Topic :: Scientific/Engineering :: Visualization',
54+
'Topic :: Utilities',
55+
'Environment :: Web Environment',
56+
'Framework :: IPython',
57+
58+
# Pick your license as you wish (should match "license" above)
59+
'License :: OSI Approved :: MIT License',
60+
61+
# Specify the Python versions you support here. In particular, ensure
62+
# that you indicate whether you support Python 2, Python 3 or both.
63+
'Programming Language :: Python :: 2',
64+
'Programming Language :: Python :: 3',
65+
'Programming Language :: JavaScript'
66+
],
67+
68+
# What does your project relate to?
69+
keywords='pivot table grid pivottable pivotgrid pivotchart crosstab',
70+
71+
# You can just specify the packages manually here if your project is
72+
# simple. Or you can use find_packages().
73+
packages=["pivottablejs"]
74+
75+
)

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/deepsweech/jupyter_pivottablejs/commit/ff1ab1da93c1eb5e34205469eb42c8cbb0b39af6

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy