From 44e9e24fec35bf7697e22aaa94feccdad23e5b79 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 20 Feb 2017 23:41:38 +0100 Subject: Replaced vendored pyyaml by a dependency (#278) --- docs/install.rst | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/install.rst b/docs/install.rst index 7b0b00b..c72951c 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -46,11 +46,7 @@ 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. :: - - $ pip install PyYAML +Tablib is partially dependent on the **simplejson**, and **xlwt** modules. To reduce installation issues, fully integrated versions of all required libraries are included in Tablib. 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. :: -- cgit v1.2.1 From 46102d4be718ee6fd6c003c1387df7c940e65b2c Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Fri, 24 Feb 2017 13:38:07 +0100 Subject: Replaced vendored omnijson by the standard lib version (#279) Refs #273. --- docs/install.rst | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/install.rst b/docs/install.rst index c72951c..365cca8 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -2,7 +2,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 `. +This part of the documentation covers the installation of Tablib. The first step to using any software package is getting it properly installed. .. _installing: @@ -44,14 +44,10 @@ To download the full source history from Git, see :ref:`Source Control `. Speed Extensions ---------------- -.. versionadded:: 0.8.5 - -Tablib is partially dependent on the **simplejson**, and **xlwt** modules. To reduce installation issues, fully integrated versions of all required libraries are included in Tablib. - -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. :: - - $ pip install simplejson +You can gain some speed improvement by optionally installing the ujson_ library. +Tablib will fallback to the standard `json` module if it doesn't find ``ujson``. +.. _ujson: https://pypi.python.org/pypi/ujson .. _updates: -- cgit v1.2.1 From c5c2dffe421e663155baa7fa9a90540f6974554c Mon Sep 17 00:00:00 2001 From: yarko Date: Fri, 24 Feb 2017 06:39:53 -0600 Subject: correct example (#276) map() is a function in python2, and iterator in python3+; In any case - map is inefficient compared to either comprehensions (most efficient), or simple loops (close second). SInce in this case, data.append() returns nothing, use a simple look. It is clearer, more efficient, and works with both python2 and python3 --- docs/index.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 20103b6..55e5679 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -27,7 +27,9 @@ Tablib is an :ref:`MIT Licensed ` format-agnostic tabular dataset library, :: >>> 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 [{"Last Name": "Reitz", "First Name": "Kenneth", "Age": 22}, {"Last Name": "Monke", "First Name": "Bessie", "Age": 21}] -- cgit v1.2.1 From 05bd0d1d42e2a1aeb3b835a4ae96de7364735192 Mon Sep 17 00:00:00 2001 From: Nicolas Appriou Date: Wed, 19 Apr 2017 16:02:55 +0200 Subject: fix python interpreter supported version in doc (#286) --- docs/intro.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/intro.rst b/docs/intro.rst index 0977ecb..e3da4dc 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -77,11 +77,12 @@ 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 -- cgit v1.2.1 From e4726cb85cfe9383e7d4012a68638ebb90c58b1e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 27 Aug 2017 03:48:01 -0400 Subject: update docs Signed-off-by: Kenneth Reitz --- docs/index.rst | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 55e5679..4a0f3f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -29,18 +29,23 @@ Tablib is an :ref:`MIT Licensed ` format-agnostic tabular dataset library, >>> data = tablib.Dataset(headers=['First Name', 'Last Name', 'Age']) >>> for i in [('Kenneth', 'Reitz', 22), ('Bessie', 'Monke', 21)]: ... data.append(i) - - >>> print data.json + + >>> print(data.json) [{"Last Name": "Reitz", "First Name": "Kenneth", "Age": 22}, {"Last Name": "Monke", "First Name": "Bessie", "Age": 21}] - >>> print data.yaml + >>> print(data.yaml) - {Age: 22, First Name: Kenneth, Last Name: Reitz} - {Age: 21, First Name: Bessie, Last Name: Monke} >>> data.xlsx + >>> data.df + First Name Last Name Age + 0 Kenneth Reitz 22 + 1 Bessie Monke 21 + Testimonials ------------ -- cgit v1.2.1 From 36fa7ef097895fb0338515246beffed1557b1510 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 27 Aug 2017 03:56:14 -0400 Subject: update docs Signed-off-by: Kenneth Reitz --- docs/intro.rst | 3 +-- docs/tutorial.rst | 8 ++++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/intro.rst b/docs/intro.rst index e3da4dc..6af436d 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -49,7 +49,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 @@ -77,7 +77,6 @@ Pythons Supported At this time, the following Python platforms are officially supported: -* cPython 2.6 * cPython 2.7 * cPython 3.3 * cPython 3.4 diff --git a/docs/tutorial.rst b/docs/tutorial.rst index d552e21..1a092e9 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -139,6 +139,14 @@ Tablib's killer feature is the ability to export your :class:`Dataset` objects i +**Pandas DataFrame** :: + + >>> data.df + First Name Last Name Age + 0 Kenneth Reitz 22 + 1 Bessie Monke 21 + + ------------------------ Selecting Rows & Columns ------------------------ -- cgit v1.2.1 From ab6633549f2f2f331736f3f974483c0e39a451f2 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 28 Aug 2017 01:04:16 -0400 Subject: Update index.rst --- docs/index.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 4a0f3f0..fb6db95 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -31,17 +31,17 @@ Tablib is an :ref:`MIT Licensed ` format-agnostic tabular dataset library, ... 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) - {Age: 22, First Name: Kenneth, Last Name: Reitz} - {Age: 21, First Name: Bessie, Last Name: Monke} - >>> data.xlsx + >>> data.export('xlsx') - >>> data.df + >>> data.export('df') First Name Last Name Age 0 Kenneth Reitz 22 1 Bessie Monke 21 -- cgit v1.2.1 From ec54918f4a7303eba65e7575be52befed9c205c7 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 28 Aug 2017 01:06:43 -0400 Subject: Update tutorial.rst --- docs/tutorial.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 1a092e9..23d2773 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -115,33 +115,33 @@ 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') **Pandas DataFrame** :: - >>> data.df + >>> data.export('df') First Name Last Name Age 0 Kenneth Reitz 22 1 Bessie Monke 21 @@ -224,7 +224,7 @@ Let's add a dynamic column to our :class:`Dataset` object. In this example, we h 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} @@ -254,7 +254,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} @@ -354,7 +354,7 @@ When, it's often useful to create a blank row containing information on the upco # 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: -- cgit v1.2.1 From 69edb9def37be7f38a4fed6d6bf10a618eaec8e3 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 28 Aug 2017 01:14:36 -0400 Subject: Update index.rst --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index fb6db95..90289e2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -34,7 +34,7 @@ Tablib is an :ref:`MIT Licensed ` format-agnostic tabular dataset library, >>> 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} -- cgit v1.2.1 From 4c300e65a50eef72b91fa1909c9f68679723955e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Fri, 1 Sep 2017 15:42:51 -0400 Subject: update install instructions Signed-off-by: Kenneth Reitz --- docs/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/install.rst b/docs/install.rst index 365cca8..4dab923 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -16,7 +16,7 @@ Distribute & Pip Of course, the recommended way to install Tablib is with `pip `_:: - $ pip install tablib + $ pip install tablib[pandas] ------------------- -- cgit v1.2.1 From 4c5d0b1a457b55c943fbff888459ad224c8a5bcd Mon Sep 17 00:00:00 2001 From: DougHudgeon Date: Mon, 25 Jun 2018 14:25:50 +1000 Subject: Instructions for opening Excel workbook and reading the first sheet --- docs/tutorial.rst | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'docs') diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 23d2773..1fe11ee 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -289,6 +289,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 ------------------------------------ -- cgit v1.2.1 From 4f8949417e5126f8416b61d7feb6cd666bae4fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20=22RooTer=22=20Urba=C5=84ski?= Date: Wed, 12 Sep 2018 21:15:20 +0200 Subject: ujson presence no longer breaks tablib (resolves #297) (#311) --- docs/install.rst | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'docs') diff --git a/docs/install.rst b/docs/install.rst index 4dab923..a236b87 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -40,16 +40,6 @@ To download the full source history from Git, see :ref:`Source Control `. .. _zipball: http://github.com/kennethreitz/tablib/zipball/master -.. _speed-extensions: -Speed Extensions ----------------- - -You can gain some speed improvement by optionally installing the ujson_ library. -Tablib will fallback to the standard `json` module if it doesn't find ``ujson``. - -.. _ujson: https://pypi.python.org/pypi/ujson - - .. _updates: Staying Updated --------------- -- cgit v1.2.1 From b057cdf05e4b9d20f6e1743fc9c63d32c54f1908 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 2 Mar 2019 08:42:53 -0800 Subject: Trim trailing white space throughout the project Many editors clean up trailing white space on save. By removing it all in one go, it helps keep future diffs cleaner by avoiding spurious white space changes on unrelated lines. --- docs/_themes/LICENSE | 4 +-- docs/_themes/README.rst | 3 +-- docs/_themes/kr/theme.conf | 2 +- docs/_themes/kr_small/static/flasky.css_t | 44 +++++++++++++++---------------- 4 files changed, 26 insertions(+), 27 deletions(-) (limited to 'docs') 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; -- cgit v1.2.1