prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Individual columns should be able to repr if not passed in CSV
  This issue title is possibly the worst ever, so here's an example:
  
  ``` python
  import tempfile
  import pandas as pd
  from blaze import *
  ```
  
  This works:
  
  ``` python
  with tempfile.NamedTemporaryFile(delete=False) as f:
      df = pd.DataFrame(np.random.randn(10, 2))
      df.to_csv(f.name, index=False, header=False)
      csv = CSV(f.name, columns=list('ab'))  # passing columns to CSV
      t = Table(csv)
      assert t.a.isidentical(t['a'])
  ```
  
  But this:
  
  ``` python
  with tempfile.NamedTemporaryFile(delete=False) as f:
      df = pd.DataFrame(np.random.randn(10, 2))
      df.to_csv(f.name, index=False, header=False)
      csv = CSV(f.name)
      t = Table(csv, columns=list('ab'))  # passing columns to Table
      assert t.a.isidentical(t['a'])
  ```
  
  yield a `t` where `t.a` throws an error in the interpreter when I try to `repr` it.
  
  The difference is that the first propagates the columns to the `Table` (or maybe it doesn't propagate, but it uses the correct names), while in the second the columns are still represented by their "anonymous" names `_0`, `_1`, etc.
  
  
  </issue>
  <code>
  [start of blaze/api/table.py]
  1 
  2 from datashape import discover, Tuple, Record, dshape, Fixed
  3 import itertools
  4 
  5 from ..expr.core import Expr
  6 from ..expr.table import TableSymbol, TableExpr
  7 from ..data.python import Python
  8 from ..dispatch import dispatch
  9 from ..data.core import DataDescriptor, discover
  10 from ..data.pandas import into, DataFrame
  11 from .into import into
  12 
  13 names = ('_%d' % i for i in itertools.count(1))
  14 
  15 class Table(TableSymbol):
  16     """ Interactive Table
  17 
  18     Parameters
  19     ----------
  20 
  21     data: DataDescriptor, tuple, DataFrame, RDD, SQL Table, ...
  22         Anything that ``compute`` knows how to work with
  23 
  24     Optional
  25     --------
  26 
  27     name: string
  28         A name for the table
  29     columns: iterable of strings
  30         Column names, will be inferred from datasource if possible
  31     schema: string or DataShape
  32         Explitit Record containing datatypes and column names
  33     """
  34     __slots__ = 'data', 'schema', '_name', 'iscolumn'
  35 
  36     def __init__(self, data, name=None, columns=None, schema=None,
  37             iscolumn=False):
  38         if not schema:
  39             schema = discover(data).subshape[0]
  40             types = None
  41             if isinstance(schema[0], Tuple):
  42                 columns = columns or list(range(len(schema[0].dshapes)))
  43                 types = schema[0].dshapes
  44             if isinstance(schema[0], Record):
  45                 columns = columns or schema[0].names
  46                 types = schema[0].types
  47             if isinstance(schema[0], Fixed):
  48                 types = (schema[1],) * int(schema[0])
  49             if not columns:
  50                 raise TypeError("Could not infer column names from data. "
  51                                 "Please specify column names with `column=` "
  52                                 "keyword")
  53             if not types:
  54                 raise TypeError("Could not infer data types from data. "
  55                                 "Please specify schema with `schema=` keyword")
  56 
  57             schema = dshape(Record(list(zip(columns, types))))
  58         self.schema = dshape(schema)
  59 
  60         self.data = data
  61         self._name = name or next(names)
  62         self.iscolumn = iscolumn
  63 
  64     def resources(self):
  65         return {self: self.data}
  66 
  67     @property
  68     def args(self):
  69         return (id(self.data), self.schema, self._name, self.iscolumn)
  70 
  71 
  72 @dispatch(Table, dict)
  73 def _subs(o, d):
  74     return o
  75 
  76 
  77 @dispatch(Expr)
  78 def compute(expr):
  79     resources = expr.resources()
  80     if not resources:
  81         raise ValueError("No data resources found")
  82     else:
  83         return compute(expr, resources)
  84 
  85 
  86 def table_repr(expr, n=10):
  87     if not expr.resources():
  88         return str(expr)
  89     if isinstance(expr, TableExpr):
  90         head = expr.head(n + 1)
  91         result = compute(head)
  92 
  93         if expr.columns:
  94             df = into(DataFrame(columns=expr.columns), result)
  95         else:
  96             df = into(DataFrame, result)
  97         s = repr(df)
  98         if len(df) > 10:
  99             df = df[:10]
  100             s = '\n'.join(s.split('\n')[:-1]) + '\n...'
  101         return s
  102 
  103     else:
  104         return repr(compute(expr))
  105 
  106 
  107 @dispatch((type, object), TableExpr)
  108 def into(a, b):
  109     return into(a, compute(b))
  110 
  111 
  112 @dispatch(DataFrame, TableExpr)
  113 def into(a, b):
  114     columns = b.columns
  115     return into(DataFrame(columns=columns), compute(b))
  116 
  117 
  118 Expr.__repr__ = table_repr
  119
  [end of blaze/api/table.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/blaze/api/table.py b/blaze/api/table.py
  --- a/blaze/api/table.py
  +++ b/blaze/api/table.py
  @@ -4,9 +4,7 @@
   
   from ..expr.core import Expr
   from ..expr.table import TableSymbol, TableExpr
  -from ..data.python import Python
   from ..dispatch import dispatch
  -from ..data.core import DataDescriptor, discover
   from ..data.pandas import into, DataFrame
   from .into import into
   
  @@ -58,6 +56,12 @@
           self.schema = dshape(schema)
   
           self.data = data
  +
  +        if hasattr(data, 'schema') and self.schema != data.schema:
  +            raise TypeError('%s schema %s does not match %s schema %s' %
  +                            (type(data).__name__, data.schema,
  +                             type(self).__name__, self.schema))
  +
           self._name = name or next(names)
           self.iscolumn = iscolumn
  
verification_info: {"golden_diff": "diff --git a/blaze/api/table.py b/blaze/api/table.py\n--- a/blaze/api/table.py\n+++ b/blaze/api/table.py\n@@ -4,9 +4,7 @@\n \n from ..expr.core import Expr\n from ..expr.table import TableSymbol, TableExpr\n-from ..data.python import Python\n from ..dispatch import dispatch\n-from ..data.core import DataDescriptor, discover\n from ..data.pandas import into, DataFrame\n from .into import into\n \n@@ -58,6 +56,12 @@\n         self.schema = dshape(schema)\n \n         self.data = data\n+\n+        if hasattr(data, 'schema') and self.schema != data.schema:\n+            raise TypeError('%s schema %s does not match %s schema %s' %\n+                            (type(data).__name__, data.schema,\n+                             type(self).__name__, self.schema))\n+\n         self._name = name or next(names)\n         self.iscolumn = iscolumn\n", "issue": "Individual columns should be able to repr if not passed in CSV\nThis issue title is possibly the worst ever, so here's an example:\n\n``` python\nimport tempfile\nimport pandas as pd\nfrom blaze import *\n```\n\nThis works:\n\n``` python\nwith tempfile.NamedTemporaryFile(delete=False) as f:\n    df = pd.DataFrame(np.random.randn(10, 2))\n    df.to_csv(f.name, index=False, header=False)\n    csv = CSV(f.name, columns=list('ab'))  # passing columns to CSV\n    t = Table(csv)\n    assert t.a.isidentical(t['a'])\n```\n\nBut this:\n\n``` python\nwith tempfile.NamedTemporaryFile(delete=False) as f:\n    df = pd.DataFrame(np.random.randn(10, 2))\n    df.to_csv(f.name, index=False, header=False)\n    csv = CSV(f.name)\n    t = Table(csv, columns=list('ab'))  # passing columns to Table\n    assert t.a.isidentical(t['a'])\n```\n\nyield a `t` where `t.a` throws an error in the interpreter when I try to `repr` it.\n\nThe difference is that the first propagates the columns to the `Table` (or maybe it doesn't propagate, but it uses the correct names), while in the second the columns are still represented by their \"anonymous\" names `_0`, `_1`, etc.\n\n", "before_files": [{"content": "\nfrom datashape import discover, Tuple, Record, dshape, Fixed\nimport itertools\n\nfrom ..expr.core import Expr\nfrom ..expr.table import TableSymbol, TableExpr\nfrom ..data.python import Python\nfrom ..dispatch import dispatch\nfrom ..data.core import DataDescriptor, discover\nfrom ..data.pandas import into, DataFrame\nfrom .into import into\n\nnames = ('_%d' % i for i in itertools.count(1))\n\nclass Table(TableSymbol):\n    \"\"\" Interactive Table\n\n    Parameters\n    ----------\n\n    data: DataDescriptor, tuple, DataFrame, RDD, SQL Table, ...\n        Anything that ``compute`` knows how to work with\n\n    Optional\n    --------\n\n    name: string\n        A name for the table\n    columns: iterable of strings\n        Column names, will be inferred from datasource if possible\n    schema: string or DataShape\n        Explitit Record containing datatypes and column names\n    \"\"\"\n    __slots__ = 'data', 'schema', '_name', 'iscolumn'\n\n    def __init__(self, data, name=None, columns=None, schema=None,\n            iscolumn=False):\n        if not schema:\n            schema = discover(data).subshape[0]\n            types = None\n            if isinstance(schema[0], Tuple):\n                columns = columns or list(range(len(schema[0].dshapes)))\n                types = schema[0].dshapes\n            if isinstance(schema[0], Record):\n                columns = columns or schema[0].names\n                types = schema[0].types\n            if isinstance(schema[0], Fixed):\n                types = (schema[1],) * int(schema[0])\n            if not columns:\n                raise TypeError(\"Could not infer column names from data. \"\n                                \"Please specify column names with `column=` \"\n                                \"keyword\")\n            if not types:\n                raise TypeError(\"Could not infer data types from data. \"\n                                \"Please specify schema with `schema=` keyword\")\n\n            schema = dshape(Record(list(zip(columns, types))))\n        self.schema = dshape(schema)\n\n        self.data = data\n        self._name = name or next(names)\n        self.iscolumn = iscolumn\n\n    def resources(self):\n        return {self: self.data}\n\n    @property\n    def args(self):\n        return (id(self.data), self.schema, self._name, self.iscolumn)\n\n\n@dispatch(Table, dict)\ndef _subs(o, d):\n    return o\n\n\n@dispatch(Expr)\ndef compute(expr):\n    resources = expr.resources()\n    if not resources:\n        raise ValueError(\"No data resources found\")\n    else:\n        return compute(expr, resources)\n\n\ndef table_repr(expr, n=10):\n    if not expr.resources():\n        return str(expr)\n    if isinstance(expr, TableExpr):\n        head = expr.head(n + 1)\n        result = compute(head)\n\n        if expr.columns:\n            df = into(DataFrame(columns=expr.columns), result)\n        else:\n            df = into(DataFrame, result)\n        s = repr(df)\n        if len(df) > 10:\n            df = df[:10]\n            s = '\\n'.join(s.split('\\n')[:-1]) + '\\n...'\n        return s\n\n    else:\n        return repr(compute(expr))\n\n\n@dispatch((type, object), TableExpr)\ndef into(a, b):\n    return into(a, compute(b))\n\n\n@dispatch(DataFrame, TableExpr)\ndef into(a, b):\n    columns = b.columns\n    return into(DataFrame(columns=columns), compute(b))\n\n\nExpr.__repr__ = table_repr\n", "path": "blaze/api/table.py"}]}