BrandonFors/pandas-github-issues huggingface dataset:
BUG: pandas.cut and negative values #14652
State: closed

 - [OK ] closes #14652
 - [OK] tests passed
 - [OK ] passes ``git diff upstream/master | flake8 --diff``



Labels:
name: Bug
name: Groupby
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode

Comments:
tests pls

pls add an entry in whatsnew for 0.19.2

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14663?src=pr) is 85.28% (diff: 100%)

> Merging [#14663](https://codecov.io/gh/pandas-dev/pandas/pull/14663?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will not change coverage

``` diff
@@             master     #14663   diff @@
==========================================
  Files           140        140          
  Lines         50693      50693          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43234      43234          
  Misses         7459       7459          
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [3f523f3...8db26db](https://codecov.io/gh/pandas-dev/pandas/compare/3f523f3652602c7105194b19b72ff30bbff47258...8db26db02509300c04150d69e1e1c779cab8cdb6?src=pr)

Please let me know if that's ok because I wasn't sure where to add the test case.

Thanks @jreback, now it should be fine.

thanks!
COMPAT: Cast to string before raise in read_stata
State: closed

In `pandas.io.stata::StataReader::_read_old_header` we
try to raise a ValueError.

I'm working on making a test, but this is buried pretty deep.
For now, `typlist` has type `List[int]`. We call

```python
','.join(typlist)
```

which errors on py3 (and python 2 I guess?). This came up in #13856, see https://travis-ci.org/pandas-dev/pandas/jobs/175705122#L1284 for the failure.

@kshedden any memory of writing this code? This is a bare `except` but it looks like the only exception that would trigger this is an `IndexError` when something in `typlist` is out of bounds on `self.TYPE_MAP`. Any hints on writing a test to exercise this code? If not I'll dig in more tonight.

Labels:
name: Compat
description: pandas objects compatability with Numpy or Python functions
name: IO Stata
description: read_stata, to_stata

Comments:
I canceled the CI builds since there aren't any new tests (yet)

Looking further, @PKEuS would have added originally in https://github.com/kshedden/pandas/commit/87d41f315f4c4ba50dde7de30e8287ab750bf13d#diff-2def41db3b4d04fb64de8313c0e6c25eR380 (the highlighted line had the necessary `str`conversion, but that was lost somewhere along the way). Sorry for the unnecessary ping Kerby.

@jreback any objections to merging this as-is (without any tests). I've verified that our current test suite doesn't touch these lines, so I'm not making anything _worse_ 😆

lgtm.
[WIP] set_axis now has inplace=False
State: closed

 - [ ] closes #14636
 - [ ] tests added / passed
 - [ ] passes ``git diff upstream/master | flake8 --diff``
 - [ ] whatsnew entry



Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: API Design

Comments:
https://github.com/pandas-dev/pandas/issues/14636

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14656?src=pr) is 85.28% (diff: 50.00%)

> Merging [#14656](https://codecov.io/gh/pandas-dev/pandas/pull/14656?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will decrease coverage by **<.01%**

``` diff
@@             master     #14656   diff @@
==========================================
  Files           140        140          
  Lines         50693      50697     +4   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43234      43235     +1   
- Misses         7459       7462     +3   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [1d6dbb4...c10a2f4](https://codecov.io/gh/pandas-dev/pandas/compare/1d6dbb41b26a39121ec8c4f19f5da78bb0ab4af7...c10a2f40683fa024dd7012bfff40484109dd6de8?src=pr)

needs tests and lint fixing (which will now show up after you rebase)

@denfromufa can you add tests?
closing as stale
DOC: Update Series.mode docstring
State: closed

 - [ ] closes #xxxx
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master | flake8 --diff``
 - [ ] whatsnew entry

Series mode method does not support sort parameter, even though the documentation says so. Neither does the underlying function from pandas.core.algorithms.

Labels:
name: Docs

Comments:
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14653?src=pr) is 85.28% (diff: 100%)

> Merging [#14653](https://codecov.io/gh/pandas-dev/pandas/pull/14653?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will not change coverage

``` diff
@@             master     #14653   diff @@
==========================================
  Files           140        140          
  Lines         50693      50693          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43234      43234          
  Misses         7459       7459          
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [1d6dbb4...0d250c2](https://codecov.io/gh/pandas-dev/pandas/compare/1d6dbb41b26a39121ec8c4f19f5da78bb0ab4af7...0d250c22bf162f426583adfd29c7c1594a5d81ea?src=pr)

@sakkemo Thanks for the PR!

This was added in the original PR that added the `mode` method, but this indeed does not really seem to be correct (https://github.com/pandas-dev/pandas/pull/5380). Possibly the return values will be sorted if there are multiple return values?

Yes, the return values are sorted! It says so in the return value part of the docstring (hidden by the fold in github by default), but perhaps it could be added in the description as well.

```
     Returns
     -------
     modes : Series (sorted)
```

Regarding the list at the top, do I need to add an issue? Also I didn't know to which whatsnew file add the changes, 0.19.2 or 0.20.0. It depends on when this is merged, of course.

@sakkemo Thanks!
DOC: Explain pivot vs. pivot_table (#6950)
State: closed

 - [x] closes #6950




Labels:
name: Docs

Comments:
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14650?src=pr) is 85.28% (diff: 100%)

> Merging [#14650](https://codecov.io/gh/pandas-dev/pandas/pull/14650?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will decrease coverage by **<.01%**

``` diff
@@             master     #14650   diff @@
==========================================
  Files           140        140          
  Lines         50693      50693          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          43235      43234     -1   
- Misses         7458       7459     +1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [a7604fc...e98b27d](https://codecov.io/gh/pandas-dev/pandas/compare/a7604fcd8e105221c5cd5d469be9a3a308325631...e98b27d220a618d9c9f8536f081d4dc48181203f?src=pr)

@jorisvandenbossche @jreback  Thanks for the feedback. Implemented the changes you guys suggested. 

@mroeschke Thanks a lot! (feel free to do more PRs with doc improvements :-))
Standardize function signatures
State: closed

Standardize the following function signatures:

1) `repeat(reps, *args, **kwargs)`
2) `searchsorted(value, side='left', sorter=None)`

Closes #12662.

Labels:
name: Clean

Comments:
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14645?src=pr) is 85.22% (diff: 97.67%)
> Merging [#14645](https://codecov.io/gh/pandas-dev/pandas/pull/14645?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **<.01%**

```diff
@@             master     #14645   diff @@
==========================================
  Files           143        143          
  Lines         50807      50813     +6   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43297      43304     +7   
+ Misses         7510       7509     -1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [d8e427b...f448639](https://codecov.io/gh/pandas-dev/pandas/compare/d8e427bda07fc350dfa327df43b790697e733747...f4486393ea0c0953769aa0237b6186324e85aa07?src=pr)
@jreback , @chris-b1  : Everything looks green.  Ready to merge if there are no concerns.

lgtm.

@jreback , @jorisvandenbossche : Everything seems to be passing still.  Ready to merge if there are no other concerns.
@jreback , @jorisvandenbossche : Changes made, and everything seems to be passing still.  Ready to merge if there are no other concerns.
@gfyoung Thanks!
BUG: iloc misbehavior with pd.Series: sometimes returns pd.Categorical, fixes #14580
State: closed

 - [x] closes #xxxx
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master | flake8 --diff``
 - [x] whatsnew entry

closes https://github.com/pandas-dev/pandas/issues/14580


Labels:
name: Bug
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Categorical
description: Categorical Data Type

Comments:
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14642?src=pr) is 84.53% (diff: 90.00%)
> Merging [#14642](https://codecov.io/gh/pandas-dev/pandas/pull/14642?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will decrease coverage by **0.02%**

```diff
@@             master     #14642   diff @@
==========================================
  Files           144        144          
  Lines         51058      51061     +3   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          43177      43166    -11   
- Misses         7881       7895    +14   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [e503d40...f6b1790](https://codecov.io/gh/pandas-dev/pandas/compare/e503d40ace473556990e5453ed5b4c9aa96e24ff...f6b1790e06f9f17fb0046927ee768d6c3c319159?src=pr)
It looks like appveyor CI check failed due to connectivity problem. Is it possible to restart it?

@nathalier Can you add a whatsnew note for this?
@jorisvandenbossche I added whatsnew to 0.19.2. Is it OK?
thanks!
ENH: Explicit range checking when writing Stata
State: closed

 - [X] closes #14618
 - [X] tests added / passed
 - [X] passes ``git diff upstream/master | flake8 --diff``
 - [X] whatsnew entry

Add explicit error checking for out-of-range doubles when writing Stata files

closes #14618

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

Comments:
@jreback That doesn't work since it is `True` for `np.float32`.

Changed the approach and also added check for `float32` column range with upcast if needed.

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14637?src=pr) is 85.28% (diff: 100%)

> Merging [#14637](https://codecov.io/gh/pandas-dev/pandas/pull/14637?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **<.01%**

``` diff
@@             master     #14637   diff @@
==========================================
  Files           140        140          
  Lines         50693      50706    +13   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43235      43247    +12   
- Misses         7458       7459     +1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [726efc7...55a98f5](https://codecov.io/gh/pandas-dev/pandas/compare/726efc7cd55744eb88636dd6f11293f18355a10a...55a98f5d8f2e6c723a2c68198790d36eb3fbfbfe?src=pr)

Need to check behavior of infs/-inf, as well as NaN in Stata.  It might support these values.

so infs are not allowed in state at all?

`+inf` is a missing value, appears in Stata the same as `NaN` (denoted with a `.`). Basically Stata always uses the largest representable numbers as missing values, and everything above the upper cutoff for a double is a missing value.  I think users who with to express a missing value in Stata should be forced to use `NaN` which exports fine.

`-inf` is allowed

ok, that's fine then. 

thanks!
BLD: Add missing inline declarations
State: closed


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

Comments:
I am compiling pandas with libpython into a static binary. It works after this patch; otherwise the symbols in the headers result in redefinition errors, since they are included in both `tslib.pyx` and `parser.pyx`. (This issue does not affect regular builds of pandas because tslib and parser are compiled and loaded as separate dynamic libraries.) `numpy_helper.h` already annotates all other symbols defined in it with `PANDAS_INLINE`, so I though that this patch is straightforward and did not explain this creating the pull request.

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14611?src=pr) is 85.27% (diff: 100%)

> Merging [#14611](https://codecov.io/gh/pandas-dev/pandas/pull/14611?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will not change coverage

``` diff
@@             master     #14611   diff @@
==========================================
  Files           140        140          
  Lines         50693      50693          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits          43230      43230          
  Misses         7463       7463          
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [2e276fb...1df4eb3](https://codecov.io/gh/pandas-dev/pandas/compare/2e276fb2fec6dd04d6abcf5e79c03853ee86cd24...1df4eb3a056ff81a7214c24e05af200b0f48dc39?src=pr)

The latest patch :
- adds missing inlines
- prepares `total_seconds` and `get_long_attr` in `datetime_helper.h` for removal (now only `ujson/python/objToJSON.c` depends on them)
- fixes import error reporting that I saw [here](https://ci.appveyor.com/project/jreback/pandas-465/build/1.0.1766/job/hscus0h1el92sq0h) (`ImportError: C extension: l_seconds not built`)
- declares `cmp_pandas_datetimestruct` in `np_datetime.h` which is used by `tslib.pyx` through the cimport in `datetime.pxd`

can you rebase / update. I think this got lost in the shuffle.
can you rebase?
I accidentally deleted my branch before pushing, and now that I pushed the rebased patch I have no authority to reopen the issue.
@orivej Even core contributors don't have this authority :-) so you can just open an new PR
Fix parse empty df
State: closed

 - [x] closes #14515 
 - [x] tests added / passed
 - [x] passes ``git diff upstream/master | flake8 --diff``
 - [x] whatsnew entry

This commit fixes a bug where `read_csv` failed when given a file with a multiindex header and empty content. Because pandas reads index names as a separate line following the header lines, the reader looks for the line with index names in it. If the content of the dataframe is empty, the reader will choke. This bug surfaced after https://github.com/pandas-dev/pandas/issues/6618 stopped writing an extra line after multiindex columns, which led to a situation where pandas could write CSV's that it couldn't then read. 

This commit changes that behavior by explicitly checking if the index name row exists, and processing it correctly if it doesn't.

Labels:
name: Bug
name: IO CSV
description: read_csv, to_csv
name: MultiIndex

Comments:
@bkandel You have several tests that are failing now (I think also the one you added)

@jorisvandenbossche Sorry for the delay in fixing this -- there was more complexity here than I realized. I think it's getting there.

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14596?src=pr) is 85.20% (diff: 100%)
> Merging [#14596](https://codecov.io/gh/pandas-dev/pandas/pull/14596?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **<.01%**

```diff
@@             master     #14596   diff @@
==========================================
  Files           143        143          
  Lines         50787      50793     +6   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43273      43280     +7   
+ Misses         7514       7513     -1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [f26b049...32e3b0a](https://codecov.io/gh/pandas-dev/pandas/compare/f26b049786624ed983f2718687c23e3f1adbb670...32e3b0a01930c48a51d1a7c209dee9724fd5ac19?src=pr)
@bkandel looks pretty good. ping when all green.

@jreback all green. Should be ready for final review now. 

@jreback just rebased and should be good to go now.
thanks!
nunique  aggerigation failes on empty frames
State: closed

The following code fails 

>     df = pd.DataFrame(columns=['a','b','c'])    
>     df.groupby('a',as_index=False).agg({'b':'nunique'})

with an exception 

> Traceback (most recent call last):
>   File "/Users/ilangadassi/Documents/workspace/python/MyTests/test1.py", line 75, in <module>
>     testDfGroup()
>   File "/Users/ilangadassi/Documents/workspace/python/MyTests/test1.py", line 71, in testDfGroup
>     df.groupby('a',as_index=False).agg({'b':'nunique'})
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py", line 3774, in aggregate
>     return super(DataFrameGroupBy, self).aggregate(arg, *args, **kwargs)
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py", line 3272, in aggregate
>     result, how = self._aggregate(arg, _level=_level, *args, **kwargs)
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/base.py", line 549, in _aggregate
>     result = _agg(arg, _agg_1dim)
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/base.py", line 500, in _agg
>     result[fname] = func(fname, agg_how)
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/base.py", line 483, in _agg_1dim
>     return colg.aggregate(how, _level=(_level or 0) + 1)
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py", line 2660, in aggregate
>     return getattr(self, func_or_funcs)(*args, **kwargs)
>   File "/Users/ilangadassi/anaconda/lib/python2.7/site-packages/pandas/core/groupby.py", line 3023, in nunique
>     res = out if ids[0] != -1 else out[1:]
> IndexError: index 0 is out of bounds for axis 0 with size 0
> 

 - [ ] closes #xxxx
 - [ ] tests added / passed
 - [ ] passes ``git diff upstream/master | flake8 --diff``
 - [ ] whatsnew entry


Labels:

Comments:
@redsum I think you meant to open an issue, not a pull request. Can you post again with this link: https://github.com/pandas-dev/pandas/issues/new
Update GitHub org from pydata to pandas-dev
State: closed

It looks like the repo moved owners from `pydata` to `pandas-dev`. This pull request updates the repository to refer to `pandas-dev/pandas` rather than `pydata/pandas`.

- [x] passes ``git diff upstream/master | flake8 --diff``
- [ ] tests added / passed
- [ ] whatsnew entry


Labels:
name: Docs

Comments:
I didn't replace the following two URLs:
- https://gitter.im/pydata/pandas
- http://scatterci.github.io/pydata/pandas

I did replace what's new URLs -- not sure if "what's new" files should be immutable after release?

@dhimmel there are only very very few changes remaining, you are adding files that are already deleted

> you are adding files that are already deleted

@jreback sorry I'm confused. I didn't think I was adding any new files? Where have they been deleted?

Do you also want me to doc updates, like removing the Google Group Mailing List link? That seems unrelated to this PR, but I'm happy to make those changes here if desired.

looks at the changes, some were changed from pandas-dev TO pydata (and not the reverse)

@jreback The ones that are changed back to pydata, are the pandas-datareader ones, so it is correct to change this back

@jreback see https://github.com/pandas-dev/pandas/pull/14575#discussion_r86357051: `pandas-datareader` is still hosted at pydata. 

> looks at the changes, some were changed from pandas-dev TO pydata (and not the reverse)

Check the diff for the entire PR.

## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14575?src=pr) is 85.27% (diff: 100%)

> Merging [#14575](https://codecov.io/gh/pandas-dev/pandas/pull/14575?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **<.01%**

``` diff
@@             master     #14575   diff @@
==========================================
  Files           140        140          
  Lines         50693      50693          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43229      43230     +1   
+ Misses         7464       7463     -1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [e1cdc4b...2368761](https://codecov.io/gh/pandas-dev/pandas/compare/e1cdc4b83d7e970e9683056be722d5fa2a00fa70...2368761a396b2fa00a6201c46e0ca8702eab9d60?src=pr)

Thanks @dhimmel
ENH: return an OrderedDict from read_excel with sheetname=None
State: closed

 - [x] closes #9930
 - [x] tests added / passed
 - [ ] passes ``git diff upstream/master | flake8 --diff``
 - [x] whatsnew entry



Labels:
name: IO Excel
description: read_excel, to_excel

Comments:
## [Current coverage](https://codecov.io/gh/pandas-dev/pandas/pull/14571?src=pr) is 85.27% (diff: 100%)

> Merging [#14571](https://codecov.io/gh/pandas-dev/pandas/pull/14571?src=pr) into [master](https://codecov.io/gh/pandas-dev/pandas/branch/master?src=pr) will increase coverage by **<.01%**

``` diff
@@             master     #14571   diff @@
==========================================
  Files           140        140          
  Lines         50693      50693          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43229      43230     +1   
+ Misses         7464       7463     -1   
  Partials          0          0          
```

> Powered by [Codecov](https://codecov.io?src=pr). Last update [e1cdc4b...1a037a6](https://codecov.io/gh/pandas-dev/pandas/compare/e1cdc4b83d7e970e9683056be722d5fa2a00fa70...1a037a63d7b4720f78a4858f6434dada665a7441?src=pr)

@scls19fr Thanks a lot!