Columns should be of type int.

Note: this worked in py2.7.8, but in py3.4.1 isinstance(i, int) is False for numpy.int64.
Better to avoid it anyway.
Fix crash when col_vars not given.
Use variable's to_val method instead of a custom mapping.

This is more general, but might be slower - improve to_val if needed.
Fix unit test.