DOC: #22896, Fixed docstring of to_stata in pandas/core/frame.py 
State: closed

- [x] closes #22896
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] passes `./scripts/validate_docstrings.py pandas.DataFrame.to_stata`


Labels:
name: Docs
name: IO Stata
description: read_stata, to_stata

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

 - There are no PEP8 issues in the file [`pandas/core/frame.py`](https://github.com/ryankarlos/pandas/blob/64e02d0b9c670b7cc1879ff374d640d090788b48/pandas/core/frame.py) !



##### Comment last updated on November 20, 2018 at 21:28 Hours UTC
Ive followed the docstring format here https://pandas.pydata.org/pandas-docs/stable/contributing_docstring.html 

Ive added in a returns section for to_stata in pandas/core/frame.py, corrected linting issues and modified the examples as some of the variables (mainly for the date example) were not defined and hence failing some of the tests. 

For some reason, the tests were throwing up linting errors for an unrelated older pull request - but Ive corrected these as well.

Thanks for the work on this @ryankarlos 

Can you leave in this PR just the changes in the `to_stata` docstring please? Things become more complex if we mix things, and I see some blank lines added in unrelated code, and changes to the `split` function (which are welcome, but in a separate PR).

I also see that there are PEP-8 issues in the examples, and may be they can be simplified a bit.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23152?src=pr&el=h1) Report
> Merging [#23152](https://codecov.io/gh/pandas-dev/pandas/pull/23152?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/99df7da9ef5b3b210f3045ee19279808368def28?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #23152   +/-   ##
=======================================
  Coverage   92.29%   92.29%           
=======================================
  Files         161      161           
  Lines       51493    51493           
=======================================
  Hits        47524    47524           
  Misses       3969     3969
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.68% <ø> (ø)` | :arrow_up: |
| #single | `42.32% <ø> (ø)` | :arrow_up: |

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

------

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

> Thanks for the work on this @ryankarlos
> 
> Can you leave in this PR just the changes in the `to_stata` docstring please? Things become more complex if we mix things, and I see some blank lines added in unrelated code, and changes to the `split` function (which are welcome, but in a separate PR).
> 
> I also see that there are PEP-8 issues in the examples, and may be they can be simplified a bit.

@datapythonista Sorry for that, I have undone the changes to the other docstring and only left the `to_stata` one. I wasn't sure what those PEP-8 issues regarding the escape sequence were referring to (as they didn't show up in the `flake8` test )- I have modified and simplified the examples and include `-` instead of `\` between the days, month and year .... seems like that may have fixed the problem.
@datapythonista let me know if there are any updates required
Looks good, added some comments.
@datapythonista Did you add comments to the latest commit - as I cannot find anything ?
@datapythonista Thanks for the comments - incorporated the changes.
@datapythonista  added requested changes
@datapythonista Thanks, changes added -  all green now
lgtm, just changed a word. I'll wait for for someone else to merge this, so we have an extra pair of eyes on it.

Thanks @ryankarlos 
@jreback  All green now
thanks @ryankarlos