summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorJean Jordaan <jean.jordaan@gmail.com>2019-03-03 13:29:21 +0700
committerGitHub <noreply@github.com>2019-03-03 13:29:21 +0700
commitaddaa090efb4d4beacb2bd2cc6dbdb7e158fa2a9 (patch)
treede3b532ed49a0d1e8a2e333b549b129d534bff91 /docs
parentcd67a63b434c33430d8fd32d6d15027b42811d9d (diff)
parent79dc77de49b8375d616a6cabb4503feb990bb51d (diff)
downloadtablib-addaa090efb4d4beacb2bd2cc6dbdb7e158fa2a9.tar.gz
Merge branch 'master' into master
Diffstat (limited to 'docs')
-rw-r--r--docs/_themes/LICENSE4
-rw-r--r--docs/_themes/README.rst3
-rw-r--r--docs/_themes/kr/theme.conf2
-rw-r--r--docs/_themes/kr_small/static/flasky.css_t44
-rw-r--r--docs/index.rst15
-rw-r--r--docs/install.rst31
-rw-r--r--docs/intro.rst10
-rw-r--r--docs/tutorial.rst30
8 files changed, 67 insertions, 72 deletions
diff --git a/docs/_themes/LICENSE b/docs/_themes/LICENSE
index b160a8e..3d1e04a 100644
--- a/docs/_themes/LICENSE
+++ b/docs/_themes/LICENSE
@@ -1,9 +1,9 @@
-Modifications:
+Modifications:
Copyright (c) 2011 Kenneth Reitz.
-Original Project:
+Original Project:
Copyright (c) 2010 by Armin Ronacher.
diff --git a/docs/_themes/README.rst b/docs/_themes/README.rst
index 8648482..c97a9a5 100644
--- a/docs/_themes/README.rst
+++ b/docs/_themes/README.rst
@@ -1,7 +1,7 @@
krTheme Sphinx Style
====================
-This repository contains sphinx styles Kenneth Reitz uses in most of
+This repository contains sphinx styles Kenneth Reitz uses in most of
his projects. It is a drivative of Mitsuhiko's themes for Flask and Flask related
projects. To use this style in your Sphinx documentation, follow
this guide:
@@ -22,4 +22,3 @@ The following themes exist:
**kr_small**
small one-page theme. Intended to be used by very small addon libraries.
-
diff --git a/docs/_themes/kr/theme.conf b/docs/_themes/kr/theme.conf
index 307a1f0..07698f6 100644
--- a/docs/_themes/kr/theme.conf
+++ b/docs/_themes/kr/theme.conf
@@ -4,4 +4,4 @@ stylesheet = flasky.css
pygments_style = flask_theme_support.FlaskyStyle
[options]
-touch_icon =
+touch_icon =
diff --git a/docs/_themes/kr_small/static/flasky.css_t b/docs/_themes/kr_small/static/flasky.css_t
index fe2141c..71961a2 100644
--- a/docs/_themes/kr_small/static/flasky.css_t
+++ b/docs/_themes/kr_small/static/flasky.css_t
@@ -8,11 +8,11 @@
* :license: BSD, see LICENSE for details.
*
*/
-
+
@import url("basic.css");
-
+
/* -- page layout ----------------------------------------------------------- */
-
+
body {
font-family: 'Georgia', serif;
font-size: 17px;
@@ -35,7 +35,7 @@ div.bodywrapper {
hr {
border: 1px solid #B1B4B6;
}
-
+
div.body {
background-color: #ffffff;
color: #3E4349;
@@ -46,7 +46,7 @@ img.floatingflask {
padding: 0 0 10px 10px;
float: right;
}
-
+
div.footer {
text-align: right;
color: #888;
@@ -55,12 +55,12 @@ div.footer {
width: 650px;
margin: 0 auto 40px auto;
}
-
+
div.footer a {
color: #888;
text-decoration: underline;
}
-
+
div.related {
line-height: 32px;
color: #888;
@@ -69,18 +69,18 @@ div.related {
div.related ul {
padding: 0 0 0 10px;
}
-
+
div.related a {
color: #444;
}
-
+
/* -- body styles ----------------------------------------------------------- */
-
+
a {
color: #004B6B;
text-decoration: underline;
}
-
+
a:hover {
color: #6D4100;
text-decoration: underline;
@@ -89,7 +89,7 @@ a:hover {
div.body {
padding-bottom: 40px; /* saved for footer */
}
-
+
div.body h1,
div.body h2,
div.body h3,
@@ -109,24 +109,24 @@ div.indexwrapper h1 {
height: {{ theme_index_logo_height }};
}
{% endif %}
-
+
div.body h2 { font-size: 180%; }
div.body h3 { font-size: 150%; }
div.body h4 { font-size: 130%; }
div.body h5 { font-size: 100%; }
div.body h6 { font-size: 100%; }
-
+
a.headerlink {
color: white;
padding: 0 4px;
text-decoration: none;
}
-
+
a.headerlink:hover {
color: #444;
background: #eaeaea;
}
-
+
div.body p, div.body dd, div.body li {
line-height: 1.4em;
}
@@ -164,25 +164,25 @@ div.note {
background-color: #eee;
border: 1px solid #ccc;
}
-
+
div.seealso {
background-color: #ffc;
border: 1px solid #ff6;
}
-
+
div.topic {
background-color: #eee;
}
-
+
div.warning {
background-color: #ffe4e4;
border: 1px solid #f66;
}
-
+
p.admonition-title {
display: inline;
}
-
+
p.admonition-title:after {
content: ":";
}
@@ -254,7 +254,7 @@ dl {
dl dd {
margin-left: 30px;
}
-
+
pre {
padding: 0;
margin: 15px -30px;
diff --git a/docs/index.rst b/docs/index.rst
index 18d100e..570e1e5 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -30,18 +30,25 @@ and seamless format import & export.
::
>>> data = tablib.Dataset(headers=['First Name', 'Last Name', 'Age'])
- >>> map(data.append, [('Kenneth', 'Reitz', 22), ('Bessie', 'Monke', 21)])
+ >>> for i in [('Kenneth', 'Reitz', 22), ('Bessie', 'Monke', 21)]:
+ ... data.append(i)
- >>> print data.json
+
+ >>> print(data.export('json'))
[{"Last Name": "Reitz", "First Name": "Kenneth", "Age": 22}, {"Last Name": "Monke", "First Name": "Bessie", "Age": 21}]
- >>> print data.yaml
+ >>> print(data.export('yaml'))
- {Age: 22, First Name: Kenneth, Last Name: Reitz}
- {Age: 21, First Name: Bessie, Last Name: Monke}
- >>> data.xlsx
+ >>> data.export('xlsx')
<redacted binary data>
+ >>> data.export('df')
+ First Name Last Name Age
+ 0 Kenneth Reitz 22
+ 1 Bessie Monke 21
+
Testimonials
------------
diff --git a/docs/install.rst b/docs/install.rst
index 3f93f05..7246972 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -3,9 +3,7 @@
Installation
============
-This part of the documentation covers the installation of Tablib.
-The first step to using any software package is getting it properly installed.
-Please read this section carefully, or you may miss out on some nice :ref:`speed enhancements <speed-extensions>`.
+This part of the documentation covers the installation of Tablib. The first step to using any software package is getting it properly installed.
.. _installing:
@@ -21,7 +19,7 @@ Of course, the recommended way to install Tablib is with `pip <http://www.pip-in
.. code-block:: console
- $ pip install tablib
+ $ pip install tablib[pandas]
-------------------
@@ -51,31 +49,6 @@ To download the full source history from Git, see :ref:`Source Control <scm>`.
.. _zipball: http://github.com/kennethreitz/tablib/zipball/master
-.. _speed-extensions:
-
-Speed Extensions
-----------------
-
-.. versionadded:: 0.8.5
-
-Tablib is partially dependent on the **pyyaml**, **simplejson**, and **xlwt** modules.
-To reduce installation issues, fully integrated versions of all required libraries are included in Tablib.
-
-However, if performance is important to you (and it should be), you can install **pyyaml** with C extensions from PyPi.
-
-.. code-block:: console
-
- $ pip install PyYAML
-
-If you're using Python 2.5, you should also install the **simplejson** module (pip will do this for you).
-If you're using Python 2.6+, the built-in **json** module is already optimized and in use.
-
-.. code-block:: console
-
- $ pip install simplejson
-
-
-
.. _updates:
Staying Updated
diff --git a/docs/intro.rst b/docs/intro.rst
index fc952d0..9dade3d 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -48,7 +48,7 @@ Tablib is released under terms of `The MIT License`_.
Tablib License
--------------
-Copyright 2016 Kenneth Reitz
+Copyright 2017 Kenneth Reitz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -76,11 +76,11 @@ Pythons Supported
At this time, the following Python platforms are officially supported:
-* cPython 2.5
-* cPython 2.6
* cPython 2.7
-* cPython 3.1
-* cPython 3.2
+* cPython 3.3
+* cPython 3.4
+* cPython 3.5
+* cPython 3.6
* PyPy-c 1.4
* PyPy-c 1.5
diff --git a/docs/tutorial.rst b/docs/tutorial.rst
index 7545e66..421954a 100644
--- a/docs/tutorial.rst
+++ b/docs/tutorial.rst
@@ -121,30 +121,38 @@ Tablib's killer feature is the ability to export your :class:`Dataset` objects i
**Comma-Separated Values** ::
- >>> data.csv
+ >>> data.export('csv')
Last Name,First Name,Age
Reitz,Kenneth,22
Monke,Bessie,20
**JavaScript Object Notation** ::
- >>> data.json
+ >>> data.export('json')
[{"Last Name": "Reitz", "First Name": "Kenneth", "Age": 22}, {"Last Name": "Monke", "First Name": "Bessie", "Age": 20}]
**YAML Ain't Markup Language** ::
- >>> data.yaml
+ >>> data.export('yaml')
- {Age: 22, First Name: Kenneth, Last Name: Reitz}
- {Age: 20, First Name: Bessie, Last Name: Monke}
**Microsoft Excel** ::
- >>> data.xls
+ >>> data.export('xls')
<redacted binary data>
+**Pandas DataFrame** ::
+
+ >>> data.export('df')
+ First Name Last Name Age
+ 0 Kenneth Reitz 22
+ 1 Bessie Monke 21
+
+
------------------------
Selecting Rows & Columns
------------------------
@@ -224,7 +232,7 @@ In this example, we have a function that generates a random grade for our studen
Let's have a look at our data. ::
- >>> data.yaml
+ >>> data.export('yaml')
- {Age: 22, First Name: Kenneth, Grade: 0.6, Last Name: Reitz}
- {Age: 20, First Name: Bessie, Grade: 0.75, Last Name: Monke}
@@ -255,7 +263,7 @@ For example, we can use the data available in the row to guess the gender of a s
Adding this function to our dataset as a dynamic column would result in: ::
- >>> data.yaml
+ >>> data.export('yaml')
- {Age: 22, First Name: Kenneth, Gender: Male, Last Name: Reitz}
- {Age: 20, First Name: Bessie, Gender: Female, Last Name: Monke}
@@ -292,6 +300,14 @@ Now that we have extra meta-data on our rows, we can easily filter our :class:`D
It's that simple. The original :class:`Dataset` is untouched.
+Open an Excel Workbook and read first sheet
+--------------------------------
+
+To open an Excel 2007 and later workbook with a single sheet (or a workbook with multiple sheets but you just want the first sheet), use the following:
+
+data = tablib.Dataset()
+data.xlsx = open('my_excel_file.xlsx', 'rb').read()
+print(data)
Excel Workbook With Multiple Sheets
------------------------------------
@@ -358,7 +374,7 @@ it's often useful to create a blank row containing information on the upcoming d
# Write spreadsheet to disk
with open('grades.xls', 'wb') as f:
- f.write(tests.xls)
+ f.write(tests.export('xls'))
The resulting **tests.xls** will have the following layout: