blaze / blaze/odo

Can't tell discover not to use parse_dates

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

Description

```
discover(resource('/Users/yuri/rr/sstr/all2.csv'), sep=" ", na_values="NA", quotechar='"', has_header=True)
```

Csv in attachment (saved from R).

Exception:

```

---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in ()
----> 1 discover(resource('/Users/yuri/rr/sstr/all2.csv'), sep=" ", na_values="NA", quotechar='"', has_header=True, true_values="TRUE", false_values="FALSE")
2 #pd.read_csv("/Users/yuri/rr/sstr/all.csv", header=1, sep=" ", na_values="NA", quotechar='"')

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/multipledispatch/dispatcher.pyc in __call__(self, *args, **kwargs)
162 self._cache[types] = func
163 try:
--> 164 return func(*args, **kwargs)
165
166 except MDNotImplementedError:

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/odo/backends/csv.pyc in discover_csv(c, nrows, **kwargs)
203 @discover.register(CSV)
204 def discover_csv(c, nrows=1000, **kwargs):
--> 205 df = csv_to_DataFrame(c, nrows=nrows, **kwargs)
206 df = coerce_datetimes(df)
207

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/odo/backends/csv.pyc in csv_to_DataFrame(c, dshape, chunksize, nrows, **kwargs)
119 try:
120 return _csv_to_DataFrame(c, dshape=dshape,
--> 121 chunksize=chunksize, nrows=nrows, **kwargs)
122 except StopIteration:
123 if nrows:

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/odo/backends/csv.pyc in _csv_to_DataFrame(c, dshape, chunksize, **kwargs)
182 chunksize=chunksize,
183 usecols=usecols,
--> 184 **kwargs2)
185
186

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/pandas/io/parsers.pyc in parser_f(filepath_or_buffer, sep, dialect, compression, doublequote, escapechar, quotechar, quoting, skipinitialspace, lineterminator, header, index_col, names, prefix, skiprows, skipfooter, skip_footer, na_values, true_values, false_values, delimiter, converters, dtype, usecols, engine, delim_whitespace, as_recarray, na_filter, compact_ints, use_unsigned, low_memory, buffer_lines, warn_bad_lines, error_bad_lines, keep_default_na, thousands, comment, decimal, parse_dates, keep_date_col, dayfirst, date_parser, memory_map, float_precision, nrows, iterator, chunksize, verbose, encoding, squeeze, mangle_dupe_cols, tupleize_cols, infer_datetime_format, skip_blank_lines)
496 skip_blank_lines=skip_blank_lines)
497
--> 498 return _read(filepath_or_buffer, kwds)
499
500 parser_f.__name__ = name

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/pandas/io/parsers.pyc in _read(filepath_or_buffer, kwds)
279 " together yet.")
280 elif nrows is not None:
--> 281 return parser.read(nrows)
282 elif chunksize or iterator:
283 return parser

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/pandas/io/parsers.pyc in read(self, nrows)
745 raise ValueError('skip_footer not supported for iteration')
746
--> 747 ret = self._engine.read(nrows)
748
749 if self.options.get('as_recarray'):

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/pandas/io/parsers.pyc in read(self, nrows)
1229 values = self._maybe_parse_dates(values, i,
1230 try_parse_dates=True)
-> 1231 arrays.append(values)
1232
1233 index = MultiIndex.from_arrays(arrays)

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/pandas/io/parsers.pyc in _maybe_parse_dates(self, values, index, try_parse_dates)
1284 def _maybe_parse_dates(self, values, index, try_parse_dates=True):
1285 if try_parse_dates and self._should_parse_dates(index):
-> 1286 values = self._date_conv(values)
1287 return values
1288

/Users/yuri/anaconda2/envs/scipy-tutorial/lib/python2.7/site-packages/pandas/io/parsers.pyc in _should_parse_dates(self, i)
840 return self.parse_dates
841 else:
--> 842 name = self.index_names[i]
843 j = self.index_col[i]
844

TypeError: 'NoneType' object has no attribute '__getitem__'

```

[all2.csv.txt](https://github.com/blaze/odo/files/46177/all2.csv.txt)

With

```
pd.read_csv("/Users/yuri/rr/sstr/all.csv", header=0, sep=" ", na_values="NA", quotechar='"')
```

all works pretty fine.

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.