|
57 | 57 | Specifies whether or not whitespace (e.g. ``' '`` or ``'\t'``) will be
|
58 | 58 | used as the sep. Equivalent to setting ``sep='\+s'``. If this option
|
59 | 59 | is set to True, nothing should be passed in for the ``delimiter``
|
60 |
| - parameter. This parameter is currently supported for the C parser only. |
| 60 | + parameter. |
| 61 | +
|
| 62 | + .. versionadded:: 0.18.1 support for the Python parser. |
| 63 | +
|
61 | 64 | header : int or list of ints, default 'infer'
|
62 | 65 | Row number(s) to use as the column names, and the start of the data.
|
63 | 66 | Default behavior is as if set to 0 if no ``names`` passed, otherwise
|
@@ -390,7 +393,20 @@ def _read(filepath_or_buffer, kwds):
|
390 | 393 | }
|
391 | 394 |
|
392 | 395 | _c_unsupported = set(['skip_footer'])
|
393 |
| -_python_unsupported = set(_c_parser_defaults.keys()) |
| 396 | +_python_unsupported = set([ |
| 397 | + 'as_recarray', |
| 398 | + 'na_filter', |
| 399 | + 'compact_ints', |
| 400 | + 'use_unsigned', |
| 401 | + 'low_memory', |
| 402 | + 'memory_map', |
| 403 | + 'buffer_lines', |
| 404 | + 'error_bad_lines', |
| 405 | + 'warn_bad_lines', |
| 406 | + 'dtype', |
| 407 | + 'decimal', |
| 408 | + 'float_precision', |
| 409 | +]) |
394 | 410 |
|
395 | 411 |
|
396 | 412 | def _make_parser_function(name, sep=','):
|
@@ -647,8 +663,13 @@ def _get_options_with_defaults(self, engine):
|
647 | 663 | value = kwds[argname]
|
648 | 664 |
|
649 | 665 | if engine != 'c' and value != default:
|
650 |
| - raise ValueError('The %r option is not supported with the' |
651 |
| - ' %r engine' % (argname, engine)) |
| 666 | + if ('python' in engine and |
| 667 | + argname not in _python_unsupported): |
| 668 | + pass |
| 669 | + else: |
| 670 | + raise ValueError( |
| 671 | + 'The %r option is not supported with the' |
| 672 | + ' %r engine' % (argname, engine)) |
652 | 673 | else:
|
653 | 674 | value = default
|
654 | 675 | options[argname] = value
|
@@ -691,6 +712,9 @@ def _clean_options(self, options, engine):
|
691 | 712 | " different from '\s+' are"\
|
692 | 713 | " interpreted as regex)"
|
693 | 714 | engine = 'python'
|
| 715 | + elif delim_whitespace: |
| 716 | + if 'python' in engine: |
| 717 | + result['delimiter'] = '\s+' |
694 | 718 |
|
695 | 719 | if fallback_reason and engine_specified:
|
696 | 720 | raise ValueError(fallback_reason)
|
|
0 commit comments