BUG: read_csv with specified kwargs
State: closed

- [+] closes #21141 
- [+] tests added / passed
- [+] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Solves the issue 21141. 

Labels:
name: Bug
name: IO CSV
description: read_csv, to_csv

Comments:
Hello @r00ta! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on June 19, 2018 at 03:30 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=h1) Report
> Merging [#21176](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/6131a598a614b93e70a28b36d35819cb6081965b?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21176/graphs/tree.svg?width=650&src=pr&token=eZ4WkYLtcO&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #21176   +/-   ##
=======================================
  Coverage   91.92%   91.92%           
=======================================
  Files         153      153           
  Lines       49594    49594           
=======================================
  Hits        45590    45590           
  Misses       4004     4004
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.32% <100%> (ø)` | :arrow_up: |
| #single | `41.82% <0%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/21176/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.46% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=footer). Last update [6131a59...eedd45e](https://codecov.io/gh/pandas-dev/pandas/pull/21176?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Superseded by https://github.com/pandas-dev/pandas/pull/21431.  I think given the discussions above, I don't think there is much objection to that...

(if there is, please comment, and we can reopen no problem)
Per https://github.com/pandas-dev/pandas/pull/21431#issuecomment-396761132, we're back!

Let's see if we can clean this up then.
Marking this for `0.23.2` because if this still isn't merged by then, I can help bring it to the finish line.
@gfyoung the main difference between the `low_memory=True` and `low_memory=False` case seems to be that in the True case, the read method [here](https://github.com/r00ta/pandas/blob/1d680be82e757d79fbf3e3d6d87de3586ea5e06a/pandas/io/parsers.py#L1848) raises an exception, so it goes into `_get_empty_meta`. Would it be good to check for the combination of args before that read method is called? Or would it be somewhere much earlier?
The patch should be in `_get_empty_meta`.
@gfyoung `_get_empty_meta` does not have any knowledge of `n_rows`. How exactly do you propose to patch it up there?
@gfyoung @r00ta one possible solution is to add `nrows` parameter to `_get_empty_meta` and then check `nrows=0` instead of checking `index_names` in the changed if clause. Would that be an acceptable solution?
@cgopalan : The handling I think should be independent of `nrows` as it is in the current PR.
@gfyoung so the current changes in the PR are fine?
@cgopalan : Sorry for not responding sooner!  Yes, these changes are fine, and we will try to merge this.

@jschendel @mroeschke @jreback : All comments that you guys made have been addressed.  Waiting for CI to confirm whether it likes what I did. 🙏 
@jreback : All is green.
@jreback : Friendly ping.
thanks @r00ta @gfyoung