BrandonFors/pandas-github-issues huggingface dataset:
ENH: Make categories setitem error more readable
State: closed

Closes #46646

Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: Categorical
description: Categorical Data Type
name: Stale

Comments:
Hello @siddartha-10! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:

* In the file [`pandas/core/arrays/categorical.py`](https://github.com/pandas-dev/pandas/blob/6cfec740b731a557f0fe8f37deaa21ed3d60e196/pandas/core/arrays/categorical.py):

> [Line 1477:29](https://github.com/pandas-dev/pandas/blob/6cfec740b731a557f0fe8f37deaa21ed3d60e196/pandas/core/arrays/categorical.py#L1477): [W291](https://duckduckgo.com/?q=pep8%20W291) trailing whitespace
> [Line 1478:13](https://github.com/pandas-dev/pandas/blob/6cfec740b731a557f0fe8f37deaa21ed3d60e196/pandas/core/arrays/categorical.py#L1478): [E122](https://duckduckgo.com/?q=pep8%20E122) continuation line missing indentation or outdented
> [Line 1478:58](https://github.com/pandas-dev/pandas/blob/6cfec740b731a557f0fe8f37deaa21ed3d60e196/pandas/core/arrays/categorical.py#L1478): [W291](https://duckduckgo.com/?q=pep8%20W291) trailing whitespace
> [Line 1479:13](https://github.com/pandas-dev/pandas/blob/6cfec740b731a557f0fe8f37deaa21ed3d60e196/pandas/core/arrays/categorical.py#L1479): [E122](https://duckduckgo.com/?q=pep8%20E122) continuation line missing indentation or outdented
> [Line 1479:65](https://github.com/pandas-dev/pandas/blob/6cfec740b731a557f0fe8f37deaa21ed3d60e196/pandas/core/arrays/categorical.py#L1479): [W291](https://duckduckgo.com/?q=pep8%20W291) trailing whitespace



##### Comment last updated at 2022-07-07 12:27:07 UTC
> Thanks for the pr @siddartha-10. Can you please explain the rationale behind this change? Is there a related issue?

Yes @mzeitlin11 There is a issue #46646. Before this it was showing lot of error statements after this it just shows a few of them I believe
 > Yes @mzeitlin11 There is a issue #46646. Before this it was showing lot of error statements after this it just shows a few of them I believe

Thanks. Can you please add a test showing how this fixes the issue in #46646. See https://pandas.pydata.org/docs/development/contributing.html for some guidance on how to add a test. Looks like there is also a linting error, please see https://pandas.pydata.org/docs/development/contributing_codebase.html#pre-commit for how to fix that
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. We have another active contribution in https://github.com/pandas-dev/pandas/pull/48087, so closing in favor.
BUG: boolean indexer with NA raising when reindex is necessary
State: closed

- [x] closes #46551 (Replace xxxx with the Github issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

There are multiple options how to solve this. Alternatively, we could get the indexeer for the reindexing operation and check for -1 instead of filling the NAs

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: NA - MaskedArrays
description: Related to pd.NA and nullable extension arrays

Comments:
thanks @phofl
WARN: Don't show FutureWarning when enlarging df with iloc
State: closed

- [x] xref #47381 (Replace xxxx with the Github issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Can't be done inplace, so no need to warn

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Warnings
description: Warnings that appear or should be added to pandas

Comments:
Arraymanager seems to be a no op here...
Thanks @phofl
Equal test
State: closed

- [ ] closes #xxxx (Replace xxxx with the Github issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
See #47603 

Please open only one pr per topic
TST: Added test for strides in column major Dataframes stored in HDFS…
State: closed

…tore

- [x] closes #22073.
- [x] Tests added and passed.
- [x] All code checks passed.

Added test for column-major DataFrames stored in HDFStore which were incorrectly returned as row-major.
Tests and linter pass locally.

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: IO HDF5
description: read_hdf, HDFStore

Comments:
Thanks again @johnmantios. Awesome to have these `needs tests` issues addressed 
No problem @mroeschke. It is a great way for someone to start contributing to open-source!
Create codeql-analysis.yml
State: closed

- [ ] closes #xxxx (Replace xxxx with the Github issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
Could you remove all the comments in the config? 

i.e. essentially use the same configuration as this file: https://github.com/ibis-project/ibis/blob/master/.github/workflows/codeql-analysis.yml
Fix Period not using freq when using same base-freq.
State: closed

- [ ] closes #xxxx (Replace xxxx with the Github issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Frequency
description: DateOffsets
name: Period
description: Period data type
name: Stale

Comments:
Something that threw me off:

```py
In [30]: p = pd.Period("2020-01-01", "2d")

In [31]: p.asfreq(p.freq)
Out[31]: Period('2020-01-02', '2D')
```

Since the default for `how` of `.asfreq` is `end`, this means that using `.asfreq` is not a no-op when using multiple frequencies.
In other words, I find the behaviour insane and inconsistent:

```py
In [2]: import pandas as pd

In [3]: dr = pd.date_range("2020", freq="2d", periods=3)

In [4]: dr.to_series().asfreq("2d")
Out[4]: 
2020-01-01   2020-01-01
2020-01-03   2020-01-03
2020-01-05   2020-01-05
Freq: 2D, dtype: datetime64[ns]

In [5]: dr.to_period().to_series().asfreq("2d")
Out[5]: 
2020-01-02    2020-01-01
2020-01-04    2020-01-03
2020-01-06    2020-01-05
Freq: 2D, dtype: period[2D]
```

I have to say the experience using `Period` is very bad and frustrating.
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
CLN: Add tets and fix docstring for concat with sort=True and outer join
State: closed

cc @simonjayhawkins 

Added a couple of tests and fixed the docstring

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
Thanks @phofl
Add test for unique aggregation returning different dtypes
State: closed

- [ ] closes #22558 (Replace xxxx with the Github issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff

Comments:
@phofl I've moved my test to a new file, is this a better place for it?
Thanks @srotondo (CI failure unrelated)
BUG: `pd.period_range` ignores multiple of `start` frequency.
State: closed

Fixes: #47465

- [x] closes #47465
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Period
description: Period data type
name: Stale

Comments:
Hopefully that is fixed now.

@phofl However, during testing I found this behaviour odd:

```py
In [1]: import pandas as pd

In [2]: p = pd.Period("2020", freq="Y")

In [3]: pd.Period(p, freq="3Y")
Out[3]: Period('2020', 'A-DEC')

In [4]: pd.Period(p, freq="3D")
Out[4]: Period('2020-12-31', '3D')
```

The `freq` argument is ignored when the value is already a `Period` and has the same base-freq. I assume this is also not intended?
This looks wrong:

https://github.com/pandas-dev/pandas/blob/d9dd1289e07d86928d144e53beb3d5b8ab3c2215/pandas/_libs/tslibs/period.pyx#L2554-L2561

Checking the `_period_dtype_code` should not be sufficient, if the `.n` do not match.
This might be deliberate, are there tests covering this?
> This might be deliberate, are there tests covering this?

I would be very surprised by this, so let's see: #47613

This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
TST: added test for handling repeated keys when using Series.loc with Multiindex
State: closed


- [x] closes #19414.
- [x] Tests added and passed.
- [x] All code checks passed.

Added test for handling repeated keys when using Series.loc with Multiindex.
Tests and linter pass locally.

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: MultiIndex

Comments:
Thanks @johnmantios
ENH: Move CSSWarning to error/__init__.py per GH27656
State: closed

- [x] xref #27656. this GitHub issue is being done in multiple parts
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).


Labels:
name: Warnings
description: Warnings that appear or should be added to pandas

Comments:
Thanks again @dataxerik
TST: added test for to_json when called on numbers exceeding the int64 limit
State: closed



- [x] closes #21073
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) 
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

Added test for to_json() when called on numbers exceeding the int64 limit.
Tests and linter pass locally.

Labels:
name: Testing
description: pandas testing functions or related to the test suite

Comments:
Thanks @johnmantios
BUG: concat losing columns dtypes for join=outer
State: closed

- [x] closes #47329 (Replace xxxx with the Github issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

@simonjayhawkins This also happens for regular dtypes, so would not backport

Labels:
name: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Index
description: Related to the Index class or subclasses

Comments:
thanks @phofl
BUG: Series map ignoring na_action for dict or series mapper
State: closed

- [x] closes #47527 (Replace xxxx with the Github issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Bug
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate

Comments:
Please don’t merge yet, this needs more tests
@phofl - if you convert to draft, it can't be merged.
Tests added, ready now
Thanks @phofl
BUG: DataFrame.loc not aligning rhs df for single block case
State: closed

- [x] closes #47578 (Replace xxxx with the Github issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


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

Comments:
thanks @phofl 
#47578 was a regression from pandas-1.3.5. need to backport and move release note.
@meeseeksdev backport 1.4.x
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 1.4.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -x -m1 4fddc414b60805caf37e5e5690d27f11d02bdcc8
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #47581: BUG: DataFrame.loc not aligning rhs df for single block case'
```

4. Push to a named branch:

```
git push YOURFORK 1.4.x:auto-backport-of-pr-47581-on-1.4.x
```

5. Create a PR against branch 1.4.x, I would have named this PR:

> "Backport PR #47581 on branch 1.4.x (BUG: DataFrame.loc not aligning rhs df for single block case)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
> #47578 was a regression from pandas-1.3.5. need to backport and move release note.

backport done in https://github.com/pandas-dev/pandas/pull/47984, move release note done in https://github.com/pandas-dev/pandas/pull/48006
Adding testcase for quartile performed on a timestamp column group by ( closes #33168 )
State: closed

Have added a testcase for quartile performed on a timestamp column group by. This change closes #33168


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Groupby
name: Timezones
description: Timezone data dtype

Comments:
Hello @dannyi96! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2022-07-02 13:07:20 UTC
This is my first open source PR 🙂 any & all feedback is most welcome. 

Was wondering if one testcase would suffice here or we can add more by trying different inputs & its expected values ( similar to those above using `@pytest.mark.parametrize` )


Looks pretty good. The code checks are failing though https://github.com/pandas-dev/pandas/runs/7156494708?check_suite_focus=true
thanks @mroeschke, have corrected the code style & looks like the code checks have passed now
thanks @dannyi96
[DOC] improving the ExcelWriter docstring
State: closed

- [x] closes #47526
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).



Labels:
name: Docs
name: IO Excel
description: read_excel, to_excel

Comments:
Thanks @noatamir. Mind posting a screenshot of this docstring after the change? 
Here you go:
<img width="745" alt="Screenshot 2022-07-01 at 19 42 15" src="https://user-images.githubusercontent.com/6564007/176944732-5ed2a6b1-223d-4c7c-97e0-4c3f7a4ea3fe.png">

Thanks @noatamir! (Failure unrelated)
DEPR: numeic_only in Series and SeriesGroupBy consistency
State: closed

Part of #47500

- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Behavior changes are to functions which gained the numeric_only argument in 1.5.

Labels:
name: Resample
description: resample method
name: Deprecate
description: Functionality to remove in pandas
name: Series
description: Series data structure
name: Nuisance Columns
description: Identifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.apply

Comments:
Thanks @mroeschke - running

```
ser = Series([0, 0, 1], dtype=object)
res = ser.rolling(2).sum(numeric_only=True)
print(res)
```

On 1.4.x, this succeeds and gives the same result as when dtype=int. On main, it raises `NotImplementedError: Rolling.sum does not implement numeric_only`. This PR exhibits the same behavior as main. I'll investigate this and do a followup to replace the breaking change with a deprecation.

I've changed the OP here so that the issue isn't closed.
Great, thanks @rhshadrach
TST: Test aggregate with list values #25581
State: closed

- [ ] closes #25581
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Groupby
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff

Comments:
Hello @srotondo! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:



There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2022-07-05 20:53:06 UTC
Thanks @srotondo
TYP: misc return type annotations
State: closed

After this most of the low hanging return annotations that `pyright --createstub pandas` finds are in pandas/core (there are still plenty of more tricky return annotations).

xref #47521

Labels:
name: Testing
description: pandas testing functions or related to the test suite
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
Looks like the rebase with main is a little off
> Looks like the rebase with main is a little off

I fixed it and forced pushed
thanks @twoertwein