CLN: use unicode literals instead of compat.u
State: closed

This gets _most_ of the non-test usages


Labels:
name: Strings
description: String extension data type and string data
name: Clean

Comments:
Travis fail is pickle-plot that appears to be hitting everything right now
circle failure is Hypothesis
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24026?src=pr&el=h1) Report
> Merging [#24026](https://codecov.io/gh/pandas-dev/pandas/pull/24026?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/5b0610b875476a6f3727d7e9bedb90d370c669b5?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `39.13%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24026      +/-   ##
==========================================
- Coverage   42.46%   42.46%   -0.01%     
==========================================
  Files         161      161              
  Lines       51557    51555       -2     
==========================================
- Hits        21892    21891       -1     
+ Misses      29665    29664       -1
```

| Flag | Coverage Δ | |
|---|---|---|
| #single | `42.46% <39.13%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24026?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2h0bWwucHk=) | `19.94% <0%> (ø)` | :arrow_up: |
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `0% <0%> (ø)` | :arrow_up: |
| [pandas/io/formats/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvaHRtbC5weQ==) | `0% <0%> (ø)` | :arrow_up: |
| [pandas/core/arrays/integer.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2ludGVnZXIucHk=) | `37.97% <100%> (ø)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `50.74% <100%> (ø)` | :arrow_up: |
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `92.07% <100%> (ø)` | :arrow_up: |
| [pandas/io/parsers.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnNlcnMucHk=) | `48.54% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `55.93% <100%> (ø)` | :arrow_up: |
| [pandas/core/config.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29uZmlnLnB5) | `61.12% <14.28%> (ø)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `41.89% <25%> (ø)` | :arrow_up: |
| ... and [7 more](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24026?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/24026?src=pr&el=footer). Last update [5b0610b...705c3e4](https://codecov.io/gh/pandas-dev/pandas/pull/24026?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/24026?src=pr&el=h1) Report
> Merging [#24026](https://codecov.io/gh/pandas-dev/pandas/pull/24026?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/4b5f4d1a59a7fce09c47eb0c03ba99a6cea472c6?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `95.58%`.

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

```diff
@@            Coverage Diff             @@
##           master   #24026      +/-   ##
==========================================
- Coverage   92.21%   92.21%   -0.01%     
==========================================
  Files         161      161              
  Lines       51684    51683       -1     
==========================================
- Hits        47658    47657       -1     
  Misses       4026     4026
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <88.23%> (-0.01%)` | :arrow_down: |
| #single | `43% <38.23%> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24026?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/config.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29uZmlnLnB5) | `87.04% <100%> (ø)` | :arrow_up: |
| [pandas/io/html.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2h0bWwucHk=) | `92.66% <100%> (ø)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.4% <100%> (ø)` | :arrow_up: |
| [pandas/io/json/json.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2pzb24vanNvbi5weQ==) | `93.09% <100%> (ø)` | :arrow_up: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.68% <100%> (ø)` | :arrow_up: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `97.91% <100%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.02% <100%> (ø)` | :arrow_up: |
| [pandas/io/formats/latex.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvbGF0ZXgucHk=) | `100% <100%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `87.39% <100%> (ø)` | :arrow_up: |
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `92.37% <100%> (ø)` | :arrow_up: |
| ... and [5 more](https://codecov.io/gh/pandas-dev/pandas/pull/24026/diff?src=pr&el=tree-more) | |

------

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

> Maybe we can rid of it entirely perhaps later?

There's plenty of cases left with `u("foo")` that are easy to modernize.  I didn't look too closely at the handful of `u(bar)` cases.  Presumably it will all become simpler next month after py2 is dropped.
so the reason we have this is to provide a uniform way to do this across py2 and py3. you don't then have to worry about whether you are quoting unicode or not and just use ``u``.  Is there a reason you want to change this now, rather than just wholesale change after PY2 is dropped?
> Is there a reason you want to change this now, rather than just wholesale change after PY2 is dropped?

Not especially.  Just see cleanup opportunities when browsing through modules, figure being aggressive about them is better than the alternative.

> so the reason we have this is to provide a uniform way to do this across py2 and py3. you don't then have to worry about whether you are quoting unicode or not and just use u

I'm guessing this got put in place before unicode literals got added back into py3.  since there is a built-in way of doing this, that should be preferred over a home-built solution.
> I'm guessing this got put in place before unicode literals got added back into py3. since there is a built-in way of doing this, that should be preferred over a home-built solution.

was this in 3.4? (e.g. this function was certainly done quite a long time ago).
Rebased.  This is pretty low-priority, should either merge or close.
let's close for now.