Repository: petl-developers/petl

Issue:
`convertall` does not work when table header has non-string elements
#### Minimal, reproducible code sample, a copy-pastable example if possible

```python
t = [['foo', 11, 22], [2, 2, 2]]
petl.convertall(t, lambda x: x**2)
```
#### Problem description

`convertall()` uses `head()` to access the field names, but this returns the header as is and the filed names are not usable if they are not strings. I think it should be using `fieldnames()` instead. The same bug affects other functions implemented on top of `convertall()`.

#### Version and installation information

This is observed with petl 1.7.4 but the current git head contains the same implementation of `convertall()`.


Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/45646446/badge)](https://coveralls.io/builds/45646446)

Coverage increased (+0.003%) to 91.12% when pulling **682d26eb6f76937e307668147fd341dcf197a56a on dnicolodi:convertall-fix** into **012cc7faf79d2fa8147a2cfe3a8b39b110f77051 on petl-developers:master**.


Patch:
diff --git a/petl/transform/conversions.py b/petl/transform/conversions.py
index 5328e2d..c699a79 100644
--- a/petl/transform/conversions.py
+++ b/petl/transform/conversions.py
@@ -6,7 +6,7 @@ from petl.compat import next, integer_types, string_types, text_type
 
 import petl.config as config
 from petl.errors import ArgumentError, FieldSelectionError
-from petl.util.base import Table, expr, header, Record
+from petl.util.base import Table, expr, fieldnames, Record
 from petl.util.parsers import numparser
 
 
@@ -242,7 +242,7 @@ def convertall(table, *args, **kwargs):
     """
 
     # TODO don't read the data twice!
-    return convert(table, header(table), *args, **kwargs)
+    return convert(table, fieldnames(table), *args, **kwargs)
 
 
 Table.convertall = convertall


Test patch:
diff --git a/petl/test/transform/test_conversions.py b/petl/test/transform/test_conversions.py
index 928f31b..617985f 100644
--- a/petl/test/transform/test_conversions.py
+++ b/petl/test/transform/test_conversions.py
@@ -214,6 +214,14 @@ def test_convertall():
     ieq(expect2, table2)
     ieq(expect2, table2)
 
+    # test with non-string field names
+    table1 = (('foo', 3, 4),
+              (2, 2, 2))
+    table2 = convertall(table1, lambda x: x**2)
+    expect = (('foo', 3, 4),
+              (4, 4, 4))
+    ieq(expect, table2)
+
 
 def test_convertnumbers():