blaze / blaze/odo

It is not possible to parse tab-delimited "CSV" file

Open
#327 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

I have a CSV file where the columns are separated by tab ("\t"). I am not able to read it using neither odo.CSV nor via high-level blaze interface. The problem seem to come from the csv.Sniffer throwing an exception when parsing this file. Even if I try to supply arguments describing the file format, it does not help because the sniffer is called even when not necessary.

``` python
odo.CSV("test.csv", delimiter="\t", lineterminator="\n")
```

results in:

```
----> 1 odo.CSV("test.csv", delimiter="\t", lineterminator="\n")

/home/honza/anaconda3/lib/python3.4/site-packages/odo/backends/csv.py in __init__(self, path, has_header, encoding, sniff_nbytes, **kwargs)
102 if has_header is None:
103 self.has_header = (not os.path.exists(path) or
--> 104 infer_header(path, sniff_nbytes))
105 else:
106 self.has_header = has_header

/home/honza/anaconda3/lib/python3.4/site-packages/odo/backends/csv.py in infer_header(path, nbytes, encoding, **kwargs)
58 with open_file(path, 'rb') as f:
59 raw = f.read(nbytes)
---> 60 return csv.Sniffer().has_header(raw if PY2 else raw.decode(encoding))
61
62

/home/honza/anaconda3/lib/python3.4/csv.py in has_header(self, sample)
392 # subtracting from the likelihood of the first row being a header.
393
--> 394 rdr = reader(StringIO(sample), self.sniff(sample))
395
396 header = next(rdr) # assume first row is header

/home/honza/anaconda3/lib/python3.4/csv.py in sniff(self, sample, delimiters)
187
188 if not delimiter:
--> 189 raise Error("Could not determine delimiter")
190
191 class dialect(Dialect):

Error: Could not determine delimiter
```

Am I doing something wrong? Or is it just a problem of `csv` standard module and `odo` not expecting it? Thank you for any comments...

P.S. I also posted a question on SO: http://stackoverflow.com/questions/32716093/how-do-i-read-tabulator-separated-csv-in-blaze

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.