Skip to content

Commit

Permalink
replace _StringIO with BytesIO from compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Jul 14, 2015
1 parent 451260c commit b5ef6be
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions dask/dataframe/io.py
Expand Up @@ -12,7 +12,7 @@
from itertools import count
from operator import getitem

from ..compatibility import StringIO, unicode, range
from ..compatibility import BytesIO, unicode, range
from ..utils import textblock
from .. import array as da

Expand All @@ -21,12 +21,6 @@
from .shuffle import set_partition


def _StringIO(data):
if isinstance(data, bytes):
data = data.decode()
return StringIO(data)


def file_size(fn, compression=None):
""" Size of a file on disk
Expand Down Expand Up @@ -131,12 +125,12 @@ def read_csv(fn, *args, **kwargs):

# Create dask graph
name = 'read-csv' + next(tokens)
dsk = dict(((name, i), (rest_read_csv, (_StringIO,
dsk = dict(((name, i), (rest_read_csv, (BytesIO,
(textblock, fn,
i*chunkbytes, (i+1) * chunkbytes,
kwargs['compression']))))
for i in range(1, nchunks))
dsk[(name, 0)] = (first_read_csv, (_StringIO,
dsk[(name, 0)] = (first_read_csv, (BytesIO,
(textblock, fn, 0, chunkbytes, kwargs['compression'])))

result = DataFrame(dsk, name, columns, divisions)
Expand Down

0 comments on commit b5ef6be

Please sign in to comment.