BrandonFors/pandas-github-issues huggingface dataset:
BUG: LatexFormatter.write_result multi-index
State: closed

Fixed GH issue 14484:

`LatexFormatter.write_result(...)` now does not print blanks if a
higher-order index differs from the previous row.
Also added testcase for this.

- [X] closes #14484
- [X] tests added / passed
- [X] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [X] whatsnew entry


Labels:
name: Bug
name: MultiIndex
name: IO LaTeX
description: to_latex

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=h1) Report
> Merging [#17499](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/f11bbf2f505d81900cc83ce387a6a1b1d2a2f866?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/17499/graphs/tree.svg?height=150&width=650&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17499      +/-   ##
==========================================
- Coverage   91.18%   91.17%   -0.02%     
==========================================
  Files         163      163              
  Lines       49543    49547       +4     
==========================================
- Hits        45177    45172       -5     
- Misses       4366     4375       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.95% <100%> (ø)` | :arrow_up: |
| #single | `40.21% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/formats/format.py](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvZm9ybWF0LnB5) | `96.06% <100%> (+0.01%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17499?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.77% <0%> (-0.1%)` | :arrow_down: |

------

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

@gfyoung Thanks for the comments, it is fixed and green again
can you update
@jreback : I can carry this one to the finish line.
great!

feel free to pick up any PR that is not responsive from the author and can be finished
@jreback : Could not push to the remote (permissions), so I opened #18685 .
DEPR: Add warning for True for dropna of SeriesGroupBy.nth
State: closed

- [x] deprecates undocumented params to partially addresses #11038
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Deprecate
description: Functionality to remove in pandas

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





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on September 12, 2017 at 08:38 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17493?src=pr&el=h1) Report
> Merging [#17493](https://codecov.io/gh/pandas-dev/pandas/pull/17493?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/46856c3936540a47df719d10a7699eb35673e4a4?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `80%`.

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

```diff
@@            Coverage Diff             @@
##           master   #17493      +/-   ##
==========================================
- Coverage   91.15%   91.13%   -0.02%     
==========================================
  Files         163      163              
  Lines       49534    49537       +3     
==========================================
- Hits        45153    45147       -6     
- Misses       4381     4390       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.92% <80%> (ø)` | :arrow_up: |
| #single | `40.22% <0%> (-0.07%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/17493?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/17493?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS5weQ==) | `92.22% <80%> (+0.01%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/17493?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/17493?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <0%> (-0.1%)` | :arrow_down: |

------

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

thanks @tnir
Follow up to #17422
State: closed

As a follow-up, this performs small touchups in a handful of places.

Implement .pxd file for tslibs.frequencies

cimport get_freq_code in period.pyx

Replace isinstance checks in period.pyx with C-equivalents form util

Remove unused imports from period.pyx

Remove code in tseries.frequencies that can now be imported from tslibs.frequencies

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Datetime
description: Datetime data dtype
name: Internals
description: Related to non-user accessible pandas implementation
name: Frequency
description: DateOffsets
name: Clean

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

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

```diff
@@            Coverage Diff             @@
##           master   #17472      +/-   ##
==========================================
- Coverage   91.16%   91.13%   -0.03%     
==========================================
  Files         163      163              
  Lines       49561    49534      -27     
==========================================
- Hits        45180    45144      -36     
- Misses       4381     4390       +9
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.92% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.22% <100%> (-0.08%)` | :arrow_down: |

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

------

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

thanks
Replace * imports with explicit imports; remove unused declared const…
State: closed

…ants

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Internals
description: Related to non-user accessible pandas implementation
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17470?src=pr&el=h1) Report
> Merging [#17470](https://codecov.io/gh/pandas-dev/pandas/pull/17470?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ee6185e2fb9461632949f3ba52a28b37a1f7296e?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/17470/graphs/tree.svg?token=eZ4WkYLtcO&src=pr&height=150&width=650)](https://codecov.io/gh/pandas-dev/pandas/pull/17470?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17470      +/-   ##
==========================================
- Coverage   91.16%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49590    49590              
==========================================
- Hits        45209    45200       -9     
- Misses       4381     4390       +9
```

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

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

------

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

thanks!
FYI we don't do *too* much linting for cython files. If you want to add to the script would be helpful (its ``ci/lint.sh``)
> If you want to add to the script would be helpful (its `ci/lint.sh`)

I've never had much luck with linting cython.  Part of why I like the newer `@cython.locals` and related decorators is the hope that it can be transitioned to valid python so standard tools can be used.  That's still a pipe dream for the time being.
DOC: Removed Timedelta.is_populated and fixed spelling errors
State: closed

- [x] closes #17369 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Additional fixes per comments in #17424 

Labels:
name: Docs
name: Timedelta
description: Timedelta data type

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17469?src=pr&el=h1) Report
> Merging [#17469](https://codecov.io/gh/pandas-dev/pandas/pull/17469?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/ee6185e2fb9461632949f3ba52a28b37a1f7296e?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/17469/graphs/tree.svg?src=pr&width=650&token=eZ4WkYLtcO&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/17469?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17469      +/-   ##
==========================================
- Coverage   91.16%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49590    49590              
==========================================
- Hits        45209    45200       -9     
- Misses       4381     4390       +9
```

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

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

------

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

thanks!
cdef out dtype for _Timestamp._get_field
State: closed

Follow-up to @jreback [comment](https://github.com/pandas-dev/pandas/pull/17377#discussion_r136948947) in #17377 to dtype the `out` variable in `_get_field` and `get_named_field`

Also, replaced value conversion in `_get_start_end_field` with `_maybe_convert_value_to_local` function created in #17377

Labels:
name: Datetime
description: Datetime data dtype
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17457?src=pr&el=h1) Report
> Merging [#17457](https://codecov.io/gh/pandas-dev/pandas/pull/17457?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/20fee85ede7f2052f855b8f3445cd1ffc17ee0c3?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/17457/graphs/tree.svg?src=pr&token=eZ4WkYLtcO&width=650&height=150)](https://codecov.io/gh/pandas-dev/pandas/pull/17457?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17457      +/-   ##
==========================================
- Coverage   91.15%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49591    49591              
==========================================
- Hits        45207    45198       -9     
- Misses       4384     4393       +9
```

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

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

------

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

thanks!
Use setdefault on kwds to standardize behavior
State: closed

`DateOffset.kwds` does not behave consistently, see brief discussion [here](https://github.com/pandas-dev/pandas/issues/17176#issuecomment-325214819).

This PR changes `kwds.get(name, default)` to `kwds.setdefault(name, default)` in each of the `__init__` methods in `tseries.offsets`.  This ensures that explicitly passing the default value gives the same result as not using the kwarg.

This also edits `Tick.__ne__` and `Tick.__eq__` to skip calling `DateOffset.__ne__` and `DateOffset.__eq__`, respectively, since these will always return `True` and `False`, respectively.  I make no claims as to the performance implications, but if a reader wanted to make an inference...

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:

Comments:
Test errors suggest that this can't be papered over as easily as I had hoped.  To fix this, I'll need the go-ahead to make some non-zero backwards-breaking changes.  See #17176.
Remove unused imports from period.pyx
State: closed

Replace isinstance checks with more efficient versions from util;

Remove redundant checks for isinstance(..., (timedelta, Timedelta)) since
Timedelta subclasses timedelta

The main goal is to reduce the inter-dependencies between lib/tslib/period(/frequencies/offsets).

Labels:
name: Internals
description: Related to non-user accessible pandas implementation
name: Period
description: Period data type
name: Clean

Comments:
an asv run for period benchmarks is useful for proving claims here. a simple posted timeit on performance claim is also useful to the causal reader.
I've been [instructed](https://github.com/pandas-dev/pandas/issues/17234#issuecomment-325048715) to use the `util` versions wherever possible.

No idea what the Travis error means, so am inclined to drop it.  This for now.  asv will be easier if/when #17331 is merged.
Remove unused _day and _month attrs
State: closed

closes #17429

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Internals
description: Related to non-user accessible pandas implementation
name: Clean

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17431?src=pr&el=h1) Report
> Merging [#17431](https://codecov.io/gh/pandas-dev/pandas/pull/17431?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/1981b679b0619de0765c2009684ce4abd886189d?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/17431/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/17431?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #17431      +/-   ##
==========================================
- Coverage   91.15%   91.14%   -0.02%     
==========================================
  Files         163      163              
  Lines       49581    49581              
==========================================
- Hits        45198    45189       -9     
- Misses       4383     4392       +9
```

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

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

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/17431?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/17431?src=pr&el=footer). Last update [1981b67...232900e](https://codecov.io/gh/pandas-dev/pandas/pull/17431?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
Added line decoding before sniffing at PythonParser#_make_reader
State: closed

Fixes issue when reading CSV from unencoded IO stream (i.e. WSGI request body). CSV sniffer uses regexp internally and crashes with `TypeError: cannot use a string pattern on a bytes-like object`.
This change fixes the issue. Better way, however would be to add proper encoding support to `csv.Sniffer()`.

- [ ] closes #xxxx
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: IO CSV
description: read_csv, to_csv

Comments:
Teasts are failing, and for good. Does anyone have an idea how to fix it? I'm not very fulent in python...
Seems like we have to check `line` type and only attempt decosing if it's not a string (or if it's easier to detect - if it's a `bytes-like object`).
@MOZGIII : That seems like a plan to check for `line` type.  However, you say that adding support for encodings in `csv.Sniffer()` would be preferable.  That would be a `Python` language issue, not a `pandas` issue then.  Do you think modifying `pandas` is preferable to this?
@MOZGIII : Can you also add a test that replicates the error you describe above?
@gfyoung I don't know where and how to put tests, but seems like using `io.BytesIO` as input would trigger this error...
I'm not sure yet, but seems like changing it in python would change the interface, and therefore can probably be very slow to deliver. Also, this here is nontheless a bug of pandas implemetation - so it should be definetly fixed here anyway.
@MOZGIII : But you should have an example that reproduces this error?  Don't worry about the location of the test.  Just provide an example here.
What's the problem with requiring users to wrap a byte stream in a text wrapper in this case?
@TomAugspurger it seems to be a valid workaround for this bug. I'm currently using wrapping the input in a `io.StringIO`. But pandas provides the API which is broken, that's a bug. Python, by the way, just doesn't provide an API (I'm talikng about encoding support in `csv.Sniffer()`) - and that and architectureal problem, but not a bug.

@gfyoung ok, I'll try to produce an example now.
@gfyoung I can't reproduce a bug with `io.BytesIO`. In the real world I have data from POST request body of `gunicorn` server. Out of time for this issue for now, but I'll continue on producing the example and provide it later.
closing. if you have an example which repros, pls post here (or better yet create a new issue).