DEPR: Deprecate tupleize_cols in read_csv
State: closed

xref <a href="https://github.com/pandas-dev/pandas/pull/17060#issuecomment-317692667">#17060 (comment)</a>

Labels:
name: IO CSV
description: read_csv, to_csv
name: Deprecate
description: Functionality to remove in pandas

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=h1) Report
> Merging [#17820](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/9f0ee53dad3bd14a3f0475a29d326c89c6b6aced?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17820      +/-   ##
==========================================
- Coverage   91.26%   91.24%   -0.02%     
==========================================
  Files         163      163              
  Lines       49980    49982       +2     
==========================================
- Hits        45613    45606       -7     
- Misses       4367     4376       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.05% <100%> (ø)` | :arrow_up: |
| #single | `40.25% <100%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.5% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.74% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17820?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/17820?src=pr&el=footer). Last update [9f0ee53...ee4e218](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=h1) Report
> Merging [#17820](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2ebe085e665d3e844d47a4489fdc454dfcdfe0e3?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17820      +/-   ##
==========================================
- Coverage   91.24%   91.22%   -0.02%     
==========================================
  Files         163      163              
  Lines       49992    49994       +2     
==========================================
- Hits        45613    45606       -7     
- Misses       4379     4388       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.02% <100%> (ø)` | :arrow_up: |
| #single | `40.24% <100%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `95.5% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.74% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17820?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/17820?src=pr&el=footer). Last update [2ebe085...bee9012](https://codecov.io/gh/pandas-dev/pandas/pull/17820?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

minor comment. merge when ready.
@gfyoung The warning does not seem to appear when doing ``read_csv(..., tupleize_cols=False)``, so I think we need to put the default to None, so we can warn in those cases as well?
@jorisvandenbossche : That's deliberate.  We only issue a warning on non-default arguments.  Also, `tupleize_cols=False` in the context `read_csv` means return an MI, so we're perfectly fine.
Why do we do that deliberately? 
Nothing prevents a user to specify a default value, and eg to write `pd.read_csv(..., tupleize_cols=False)`. This code will then break in the future without any warning.
> We only issue a warning on default arguments.

You mean 'non-default' arguments?
> You mean 'non-default' arguments?

Oops, yes 😄 

> Why do we do that deliberately?
Nothing prevents a user to specify a default value, and eg to write pd.read_csv(..., tupleize_cols=False). 

That's possible.  My concern is that's going to be confusing to a user if they see `tupleize_cols=None` in the docs.  This deprecation methodology that I'm using is implemented throughout the codebase.

That being said, you do bring up an interesting point.  While I haven't seen that problem arise with any of our other deprecations, I don't see why we shouldn't discuss it.
@jorisvandenbossche : I opened #17828 to address your point about function argument deprecations.
I disagree with not raising for the default value is how it is typically done. I think it is rather the other way around (we normally put the deprecated one at None, to be able to distinguish the default and an actual user passed value), but will answer on the issue you created.