MAINT: Deprecate encoding from stata reader/writer
State: closed

Deprecate the encoding parameter from all Stata reading and writing
methods and classes.  The encoding depends only on the file format and
cannot be changed by users.

- [X] closes #21244
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry


Labels:
name: Deprecate
description: Functionality to remove in pandas
name: IO Stata
description: read_stata, to_stata

Comments:
For 0.24
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21400?src=pr&el=h1) Report
> Merging [#21400](https://codecov.io/gh/pandas-dev/pandas/pull/21400?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/415012f4f38ca0cf41717c51e49bd2349cba09a8?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #21400      +/-   ##
==========================================
+ Coverage   91.89%   91.89%   +<.01%     
==========================================
  Files         153      153              
  Lines       49596    49597       +1     
==========================================
+ Hits        45576    45577       +1     
  Misses       4020     4020
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.29% <100%> (ø)` | :arrow_up: |
| #single | `41.86% <100%> (ø)` | :arrow_up: |

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

------

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

@bashtage : How come your PR is closing #21244, which is already closed?
It was the relevant issue. I had to defer the depreciation past the point
release 23.1

On Sat, Jun 9, 2018, 18:48 gfyoung <notifications@github.com> wrote:

> @bashtage <https://github.com/bashtage> : How come your PR is closing
> #21244 <https://github.com/pandas-dev/pandas/issues/21244>, which is
> already closed?
>
> —
> You are receiving this because you were mentioned.
>
>
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/21400#issuecomment-395987007>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFU5Ra9K3dl6eDqZu9n-2iAPKa8D6axCks5t7ApTgaJpZM4UhRhX>
> .
>

I added a test and fixed the whatsnew
thanks @bashtage 
I cannot check right now, but I do not think that the sentence " The encoding depends only on the file format and cannot be changed by users." is quite true. If I remember correctly, pre-118 Stata files used, in an undocumented fashion, the native encoding, Latin-1 on Windows and MacRoman on OS X, I don't remember for Linux. Officially, special characters were not supported. 

I think there is a case to be made for the encoding keyword, but with old versions dying out I am not sure whether it is worth the effort.