Repository: blaze/blaze

Issue:
Deprecate columns in Data
Not a huge deal, but having both `columns` and `fields` in `Data` could potentially confuse new users.



Discussion:
@mrocklin ok with removing `columns` entirely from the constructor?

Fine with me.  Might want to raise an informative error.


Resolving patch:
diff --git a/blaze/interactive.py b/blaze/interactive.py
--- a/blaze/interactive.py
+++ b/blaze/interactive.py
@@ -44,6 +44,12 @@
 
 def Data(data, dshape=None, name=None, fields=None, columns=None, schema=None,
          **kwargs):
+    if columns:
+        raise ValueError("columns argument deprecated, use fields instead")
+    if schema and dshape:
+        raise ValueError("Please specify one of schema= or dshape= keyword"
+                         " arguments")
+
     sub_uri = ''
     if isinstance(data, _strtypes):
         if '::' in data:
@@ -53,14 +59,6 @@ def Data(data, dshape=None, name=None, fields=None, columns=None, schema=None,
     if (isinstance(data, Iterator) and
             not isinstance(data, tuple(not_an_iterator))):
         data = tuple(data)
-    if columns:
-        warnings.warn("columns kwarg deprecated.  Use fields instead",
-                      DeprecationWarning)
-    if columns and not fields:
-        fields = columns
-    if schema and dshape:
-        raise ValueError("Please specify one of schema= or dshape= keyword"
-                         " arguments")
     if schema and not dshape:
         dshape = var * schema
     if dshape and isinstance(dshape, _strtypes):
@@ -83,11 +81,12 @@ def Data(data, dshape=None, name=None, fields=None, columns=None, schema=None,
             if names != fields:
                 raise ValueError('data column names %s\n'
                                  '\tnot equal to fields parameter %s,\n'
-                                 '\tuse Data(data).relabel(%s) to rename fields'
-                                 % (names,
-                                    fields,
-                                    ', '.join('%s=%r' % (k, v)
-                                              for k, v in zip(names, fields))))
+                                 '\tuse Data(data).relabel(%s) to rename '
+                                 'fields' % (names,
+                                             fields,
+                                             ', '.join('%s=%r' % (k, v)
+                                                       for k, v in
+                                                       zip(names, fields))))
             types = dshape.measure.types
             schema = Record(list(zip(fields, types)))
             dshape = DataShape(*(dshape.shape + (schema,)))


Test patch:
diff --git a/blaze/tests/test_interactive.py b/blaze/tests/test_interactive.py
--- a/blaze/tests/test_interactive.py
+++ b/blaze/tests/test_interactive.py
@@ -26,7 +26,7 @@
      [4, 'Denis',   400],
      [5, 'Edith',  -500]]
 
-t = Data(data, columns=['name', 'amount'])
+t = Data(data, fields=['name', 'amount'])
 
 x = np.ones((2, 2))
 
@@ -66,7 +66,7 @@ def test_create_with_schema():
 
 
 def test_create_with_raw_data():
-    t = Data(data, columns=['name', 'amount'])
+    t = Data(data, fields=['name', 'amount'])
     assert t.schema == dshape('{name: string, amount: int64}')
     assert t.name
     assert t.data == data
@@ -368,3 +368,8 @@ def test_asarray_fails_on_different_column_names():
     df = pd.DataFrame(vs)
     with pytest.raises(ValueError):
         Data(df, fields=list('abc'))
+
+
+def test_data_does_not_accept_columns_kwarg():
+    with pytest.raises(ValueError):
+        Data([(1, 2), (3, 4)], columns=list('ab'))