NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #4249 most downloaded on PyPI
A Python package for extracting, transforming and loading tables of data.
Latest stable
1.7.32
Last release 6 days ago
10 Nov 2026
Ships unpredictably
gaps range from 8 days to 13 months
Most releases are documented
notes for 49 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
15 years old
107 releases · first in 2011
Drag across the ruler to compare, or tap a release to open it.
Version 1.0 is a new major release of petl.
Version 1.0 is a new major release of petl.
The main purpose of version 1.0 is to introduce support for Python 3.4, in addition to the existing support for Python 2.6 and 2.7. petl is also now fully tested under both Windows and Linux.
Much of the functionality available in petl versions 0.x has remained unchanged in version 1.0, and most existing code that uses petl should work unchanged with version 1.0 or with minor changes. However there have been a number of API changes, and some functionality has been migrated from the petlx package.
For a complete description of the changes, see the changes section of the petl docs.
Version 1.0 is a new major release of petl. The main purpose of version 1.0 is to introduce support for Python 3.4, in addition to the existing support for Python 2.6 and 2.7. Much of the functionality available in petl versions 0.x has remained unchanged in version 1.0, and most existing code that uses petl should work unchanged with version 1.0 or with minor changes. However there have been a number of API changes, and some functionality has been migrated from the petlx package, described below.
If you have any questions about migrating to version 1.0 or find any problems or issues please email python-etl@googlegroups.com.
Version 1.0 unifies the API for working with ASCII and non-ASCII encoded text files, including CSV and HTML.
The following functions now accept an 'encoding' argument, which defaults to the value of locale.getpreferredencoding() (usually 'utf-8'): fromcsv, tocsv, appendcsv, teecsv, fromtsv, totsv, appendtsv, teetsv, fromtext, totext, appendtext, tohtml, teehtml.
The following functions have been removed as they are now redundant: fromucsv, toucsv, appenducsv, teeucsv, fromutsv, toutsv, appendutsv, teeutsv, fromutext, toutext, appendutext, touhtml, teeuhtml.
To migrate code, in most cases it should be possible to simply replace 'fromucsv' with 'fromcsv', etc.
The functionality previously available through the petl.fluent and petl.interactive modules is now available through the root petl module.
This means two things.
First, is is now possible to use either functional or fluent (i.e., object-oriented) styles of programming with the root petl module, as described in introductory section on intro_programming_styles.
Second, the default representation of table objects uses the petl.util.vis.look function, so you can simply return a table from the prompt to inspect it, as described in the introductory section on intro_interactive_use.
The petl.fluent and petl.interactive modules have been removed as they are now redundant.
To migrate code, it should be possible to simply replace "import petl.fluent as etl" or "import petl.interactive as etl" with "import petl as etl".
Note that the automatic caching behaviour of the petl.interactive module has not been retained. If you want to enable caching behaviour for a particular table, make an explicit call to the petl.util.materialise.cache function. See also intro_caching.
In version 1.0 petl table container objects implement _repr_html_() so can be returned from a cell in an IPython notebook and will automatically format as an HTML table.
Also, the petl.util.vis.display and petl.util.vis.displayall functions have been migrated across from the petlx.ipython package. If you are working within the IPython notebook these functions give greater control over how tables are rendered. For some examples, see:
http://nbviewer.ipython.org/github/petl-developers/petl/blob/v1.0/repr_html.ipynb
The petl.io.db.todb function now supports automatic table creation, inferring a schema from data in the table to be loaded. This functionality has been migrated across from the petlx package, and requires SQLAlchemy to be installed.
The functions fromsqlite3, tosqlite3 and appendsqlite3 have been removed as they duplicate functionality available from the existing functions petl.io.db.fromdb, petl.io.db.todb and petl.io.db.appenddb. These existing functions have been modified so that if a string is provided as the dbo argument it is interpreted as the name of an sqlite3 file. It should be possible to migrate code by simply replacing 'fromsqlite3' with 'fromdb', etc.
The following functions have been removed because they are overly complicated and/or hardly ever used. If you use any of these functions and would like to see them re-instated then please email python-etl@googlegroups.com: rangefacet, rangerowreduce, rangeaggregate, rangecounts, multirangeaggregate, lenstats.
The following functions were marked as deprecated in petl 0.x and have been removed in version 1.0: dataslice (use data instead), fieldconvert (use convert instead), fieldselect (use select instead), parsenumber (use numparser instead), recordmap (use rowmap instead), recordmapmany (use rowmapmany instead), recordreduce (use rowreduce instead), recordselect (use rowselect instead), valueset (use table.values(‘foo’).set() instead).
The following functions are no longer available in the root petl namespace, but are still available from a subpackage if you really need them: iterdata (use data instead), iterdicts (use dicts instead), iternamedtuples (use namedtuples instead), iterrecords (use records instead), itervalues (use values instead).
The following functions have been renamed: isordered (renamed to issorted), StringSource (renamed to MemorySource).
The function selectre has been removed as it duplicates functionality, use search instead.
A major difference between Python 2 and Python 3 involves comparison and sorting of objects of different types. Python 3 is a lot stricter about what you can compare with what, e.g., None < 1 < 'foo' works in Python 2.x but raises an exception in Python 3. The strict comparison behaviour of Python 3 is generally a problem for typical usages of petl, where data can be highly heterogeneous and a column in a table may have a mixture of values of many different types, including None for missing.
To maintain the usability of petl in this type of scenario, and to ensure that the behaviour of petl is as consistent as possible across different Python versions, the petl.transform.sorts.sort function and anything that depends on it (as well as any other functions making use of rich comparisons) emulate the relaxed comparison behaviour that is available under Python 2.x. In fact petl goes further than this, allowing comparison of a wider range of types than is possible under Python 2.x (e.g., datetime with None).
As the underlying code to achieve this has been completely reworked, there may be inconsistencies or unexpected behaviour, so it's worth testing carefully the results of any code previously run using petl 0.x, especially if you are also migrating from Python 2 to Python 3.
The different comparison behaviour under different Python versions may also give unexpected results when selecting rows of a table. E.g., the following will work under Python 2.x but raise an exception under Python 3.4:
>>> import petl as etl >>> table = [['foo', 'bar'], ... ['a', 1], ... ['b', None]] >>> # raises exception under Python 3 ... etl.select(table, 'bar', lambda v: v > 0)
To get the more relaxed behaviour under Python 3.4, use the petl.transform.selects.selectgt function, or wrap values with petl.comparison.Comparable, e.g.:
>>> # works under Python 3 ... etl.selectgt(table, 'bar', 0) +-----+-----+ | foo | bar | +=====+=====+ | 'a' | 1 | +-----+-----+ >>> # or ... ... etl.select(table, 'bar', lambda v: v > etl.Comparable(0)) +-----+-----+ | foo | bar | +=====+=====+ | 'a' | 1 | +-----+-----+
Several new extract/load modules have been added, migrating functionality previously available from the petlx package:
io_xls
io_xlsx
io_numpy
io_pandas
io_pytables
io_whoosh
These modules all have dependencies on third party packages, but these have been kept as optional dependencies so are not required for installing petl.
A new petl.transform.validation.validate function has been added to provide a convenient interface when validating a table against a set of constraints.
A new module has been added providing transformation functions based on intervals, migrating functionality previously available from the petlx package:
transform_intervals
This module requires the intervaltree module.
All configuration variables have been brought together into a new petl.config module. See the source code for the variables available, they should be self-explanatory.
The petl.push module remains in an experimental state and has been moved to the petlx extensions project.
Argument names for a small number of functions have been changed to create consistency across the API.
There are some other minor changes as well. If you are migrating from petl version 0.x the best thing is to run your code and inspect any errors. Email python-etl@googlegroups.com if you have any questions.
The source code has been substantially reorganised. This should not affect users of the petl package however as all functions in the public API are available through the root petl namespace.
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Issues & pull requests resolved in this release:
Issues & pull requests resolved in this release:
Contributors:
Thanks also to @imazor and @cons0l3.
Nothing published for this version
Nothing published for this version
Minor release adding missing petl.io to setup.py (0.25 is broken).
Minor release adding missing petl.io to setup.py (0.25 is broken).
This release includes a number of improvements and bug fixes, see the full list of issues resolved for details.
This release includes a number of improvements and bug fixes, see the full list of issues resolved for details.
Contributors to this release:
Nothing published for this version
Nothing published for this version
Nothing published for this version
Please note this release contains some backwards-incompatible changes:
Please note this release contains some backwards-incompatible changes:
petl.valuecounts() and petl.aggregate() have changed their behaviour slightly, such that the fields in the output table may be different from previous versions. If a single field is used as the key argument then that field name will be used instead of "key" in the output table header. If a compound key is used, all key fields will be output as separate fields.petl.transform.defaultbuffersize has moved to petl.transform.sorts.defaultbuffersize.Note also that the petl.transform package has been refactored to break what was a very large module up into smaller pieces. Similar work is planned for the petl.io module in a subsequent release.
A full list of all changes is available at https://github.com/alimanfoo/petl/issues?milestone=23&state=closed
List of changes: https://github.com/alimanfoo/petl/issues?labels=&milestone=22&page=1&state=closed
List of changes: https://github.com/alimanfoo/petl/issues?labels=&milestone=22&page=1&state=closed
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.