DOC: fix quotes for index and column
State: closed


Labels:
name: Docs

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

 - In the file [`pandas/core/frame.py`](https://github.com/pandas-dev/pandas/blob/2a11a3eb3d2bd55ad235ed7df5de30615e2fe37f/pandas/core/frame.py), following are the PEP8 issues :

> [Line 2045:9](https://github.com/pandas-dev/pandas/blob/2a11a3eb3d2bd55ad235ed7df5de30615e2fe37f/pandas/core/frame.py#L2045): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 2479:13](https://github.com/pandas-dev/pandas/blob/2a11a3eb3d2bd55ad235ed7df5de30615e2fe37f/pandas/core/frame.py#L2479): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 5221:21](https://github.com/pandas-dev/pandas/blob/2a11a3eb3d2bd55ad235ed7df5de30615e2fe37f/pandas/core/frame.py#L5221): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'
> [Line 5717:9](https://github.com/pandas-dev/pandas/blob/2a11a3eb3d2bd55ad235ed7df5de30615e2fe37f/pandas/core/frame.py#L5717): [E722](https://duckduckgo.com/?q=pep8%20E722) do not use bare except'



##### Comment last updated on July 15, 2017 at 20:22 Hours UTC
We only use the doubleticks if we are referring to an actual variable or function.  In this case, we are accepting the string "index" and "column"
@DJCordhose : Unless you have any objections, I will close this PR because the change isn't actually what we are looking for when it comes to documentation.  Sorry about that! 😢 

There are plenty of issues though that you are more than free to tackle under our GitHub issues tab.  Also, if there any other documentation issues that you find, feel free to submit another PR!
@gfyoung how would you make the change? I am happy to change my PR.
@DJCordhose : This is no change.  The documentation is good as is, at least for those two variables. 😢 
I don't want to discourage you from finding ways to contribute, so keep prying through the documentation!  I'm pretty sure you'll find other ways to improve it!
Oh, maybe I did not make my point clear, the generated documentation has broken quotes. 

Looking at 

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.apply.html

the quotes look like

‘index’

but should be

'index'


I'm not sure I follow you here: the quotation marks look okay to me.
Try and copy past them from the web site into your code. I am not sure if they are properly displayed on this PR.
I see the following:

"left-quotation-mark" index "right-quotation-mark"

The same for `column` for all cases.


This is what you find on the website

<li>0 or ‘index’: apply function to each column</li>
<li>1 or ‘columns’: apply function to each row</li>

Please note the broken quotes. Those are not python quotes. This is the generation result after the change. Please note the quotes that are not proper Python quotes. 

<li>0 or <code class="docutils literal"><span class="pre">'index'</span></code>: apply function to each column</li>
<li>1 or <code class="docutils literal"><span class="pre">'columns'</span></code>: apply function to each row</li>



broken
![broken](https://user-images.githubusercontent.com/394409/28242291-0f6c356c-696d-11e7-924c-eeb5684ad2b7.png)

fixed
![fixed](https://user-images.githubusercontent.com/394409/28242292-0f7cc076-696d-11e7-995d-30e065edd636.png)

Those quotation marks are perfectly fine, as we were not aiming for Python quotes necessarily.  We don't double-tick allowed string-inputs, and that's the standard for us.
I thought I directly copied this from other places within pandas, like e.g.

https://github.com/pandas-dev/pandas/blob/master/pandas/io/json/json.py#L194

I am happy to be corrected here 
That's a fair point.  We do have exceptions!  In that case, because we have a bullet-point list, we would like to indicate what part comes before the colon for readability.
It'd be good to quote them so it's easier to copy-paste into the interpreter.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16954?src=pr&el=h1) Report
> Merging [#16954](https://codecov.io/gh/pandas-dev/pandas/pull/16954?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/96168ef698ac8bbccba251258ee66958359b11bf?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #16954      +/-   ##
==========================================
- Coverage   90.98%   90.96%   -0.02%     
==========================================
  Files         161      161              
  Lines       49288    49288              
==========================================
- Hits        44846    44837       -9     
- Misses       4442     4451       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.74% <ø> (ø)` | :arrow_up: |
| #single | `40.2% <ø> (-0.07%)` | :arrow_down: |

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16954?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/16954?src=pr&el=footer). Last update [96168ef...2a11a3e](https://codecov.io/gh/pandas-dev/pandas/pull/16954?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/16954?src=pr&el=h1) Report
> Merging [#16954](https://codecov.io/gh/pandas-dev/pandas/pull/16954?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/96168ef698ac8bbccba251258ee66958359b11bf?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff             @@
##           master   #16954      +/-   ##
==========================================
- Coverage   90.98%   90.96%   -0.02%     
==========================================
  Files         161      161              
  Lines       49288    49288              
==========================================
- Hits        44846    44837       -9     
- Misses       4442     4451       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.74% <ø> (ø)` | :arrow_up: |
| #single | `40.2% <ø> (-0.07%)` | :arrow_down: |

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

------

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

> It'd be good to quote them so it's easier to copy-paste into the interpreter.

@TomAugspurger : Okay, but how much of a use-case is there for this?  Mind you, a doc-change like this should be applied to every function not only in this file but any function that involves string inputs (and there are a decent number even in this file AFAICT).
@gfyoung 
I thought it is inconsistent anyway. There are many examples where string constants are escaped the way I propose all over the code base. Changing all the spots in one go might be a bad idea, but would you not agree that having them quoted properly is a better idea than not having them quoted properly in general?
> I thought it is inconsistent anyway. There are many examples where string constants are escaped the way I propose all over the code base.

It would be helpful if you could point to several locations that you found inconsistent, as I can only think of ones where we use non-Python quotation marks, such as `read_csv` and `DataFrame.merge`.

> Changing all the spots in one go might be a bad idea, but would you not agree that having them quoted properly is a better idea than not having them quoted properly in general?

Actually, given that it should not impact the code that much, trying to tackle as many as possible on PR (especially just these in this file) would be reasonable.

I see where you're trying to go with that question, but as I said before, I don't find those quotes to be quoted "badly" (AFAIK, we've never said anything about non-Python quotes being "bad" quotes in the documentation until now from @TomAugspurger ).  That's why I pushed back against this change.
Test failure on Appveyor unrelated to PR.
@TomAugspurger : your thoughts on the discussion?
I would also say that either do it everywhere or nowhere. Closing the PR.