BrandonFors/pandas-github-issues huggingface dataset:
REF: de-duplicate wrap_agged_manager/wrap_aggregate_result
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: Refactor
description: Internal refactoring of code
name: Groupby

Comments:
Thanks @jbrockmendel
DOC Correcting EX02 errors
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.

Towards https://github.com/pandas-dev/pandas/issues/37875 and https://github.com/pandas-dev/pandas/issues/27977

Labels:
name: Docs

Comments:
Thank you @MarcoGorelli :)
BUG: ensure reindex / getitem to select columns properly copies data for extension dtypes
State: closed

I encountered this while writing more tests for Copy-on-Write. Currently, the _general_ rule is that selecting columns with a list-like indexer using getitem gives a copy:

```python
df = pd.DataFrame(np.random.randn(10, 4), columns=['a', 'b', 'c', 'd'])
subset = df[["a", "b"]]
# subset is a copy
subset.iloc[0, 0] = 0
assert df.iloc[0, 0] != 0
```

However, that doesn't seem to be the case when the columns we select are extension dtypes. When using `dtype="Float64"` in the above example, the original `df` gets updated because subset isn't a copy.

While I am not sure this is an explicitly documented rule (AFAIK this is de-facto behaviour, and only described as such in the discussions related to copy/view and CoW), I do think it would be expected that extension dtypes behave the same as numpy dtypes on this front.  
(it also makes writing tests for copy/view behaviour harder if the behaviour doesn't only change for CoW or not, but also depending on numpy vs extension dtypes. This is where I encountered the issue)

- [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
- [ ] 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: Bug
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.
name: Copy / view semantics

Comments:
+1.  This seems like the kind of thing that I'd usually want to call a bugfix and you'd want to call a breaking change.  Since its for 2.0 i'd be fine documenting it either way.
Documented as a bug fix.

We could also leave it as is, and delay the behaviour change to pandas 3.0 when Copy-on-Write would be enabled. That has the benefit of not having the performance hit in the meantime of making the copy, but the drawback that we keep the wrong behaviour for a longer time (giving more people the chance to rely on its side-effects). I would personally go for the correct behaviour right now.
DOC: Fix code style in `any` and `all` methods
State: closed

change double quotes to single quotes

- [ ] 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:
thanks for your PR, but please don't do this to any repo

closing then, please search 'good first issue' if you want something to contribute to, and check the contributing guide https://pandas.pydata.org/docs/dev/development/contributing.html
I saw mixed usage of both in those code examples, so my logic was that must be a mistake.
But I might have mistaken which style (double or single) is recommended in Pandas.
Is that what you are referring to? or just "code style" commits in general?

I don't see why I shouldn't have done this, unless mixed usage of both is valid in terms of recommended style guide.
this is the kind of thing we'd only do with an automated checker, please don't do it by hand
could do with some help on  https://github.com/pandas-dev/pandas/issues/37875 if you're interested in docs / stylistic issues
Does the automated checker also check code examples in docstrings?

Because I looked at some more methods and there were many more cases of this mixed usage of single & double quotes.

So I thought maybe it's the checker's fault for letting this happen in the first place.

**_The ones with mixed usage:_**
```
info
insert
lt
gt
le
ge
ne
eq
agg
aggregate
transform
groupby
all
any
...
```

**_The ones with double quotes:_**
```
set_flags
convert_dtypes
infer_objects
copy
get
expanding
...
```
I came across this today and see that the discrepancies still exist in the docs...

Is this not considered an issue? Maybe not a critical issue, but still, it's an eyesore...

If there is a linter that can check and fix this automatically, I think we would be happy to take a PR for that
one complication is pandas' complicated docstring substitution mechanism...I don't it would be too easy to fix this automatically, but it should be possible to verify that it's done by amending

https://github.com/pandas-dev/pandas/blob/aa3e949e2a2b72588186cb1936edb535713aefa0/scripts/validate_docstrings.py#L194-L211

to do some other check

not sure it would be worth it, and i can't commit to reviewing at this time, just pointing it out as a possibility
BUG: loc.setitem modifying values with empty indexer
State: closed

- [x] closes #45981 (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: Indexing
description: Related to indexing on series/frames, not to indexes themselves

Comments:
Thanks @phofl 
I have some code that broke between version 1.4.4 and 1.5.0. I was wondering if this merge will fix it. The code is essentially doing:

```python
import pandas as pd

df = pd.DataFrame({
    "A": [],
    "B": []
}).astype('str')

df.loc[df['A'].str.contains('STUFF'), ['A']] = df['A'] + '-' + df['B']
 ```
 
 In 1.4.4 it is a no-op but in 1.5.0 it fails with `ValueError: shape mismatch: value array of shape (0,) could not be broadcast to indexing result of shape (0,1)`.
You can check your code on our nightly builds
BUG: setting non-string value into StringArray raises ValueError instead of TypeError
State: closed

- [x] closes #49632 (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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
thx @yuanx749
REF: prune groupby paths
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: Refactor
description: Internal refactoring of code
name: Groupby

Comments:
Thanks @jbrockmendel
REF: consolidate numeric_only checks in GroupBy
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: Refactor
description: Internal refactoring of code
name: Groupby
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
thx @jbrockmendel
REF: dont rely on Grouper.ax
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.

After this we an deprecate Grouper.ax

Labels:
name: Refactor
description: Internal refactoring of code
name: Groupby

Comments:
Thanks @jbrockmendel
Power spelling first letter should be in capital
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:
Thanks but no thanks, this is fine

Closing now, but you're welcome to work on other issues
TYP: resample
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: Resample
description: resample method
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
Thanks @jbrockmendel
DOC: Formatting of generated DataFrame method docstrings
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.


My initial motivation for this was to improve the readability and appearance of this sentence in the docs. The capital letter in the middle of the sentence looked like it could be a typo when I first read it.

https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.le.html
<img width="628" alt="image" src="https://user-images.githubusercontent.com/122238526/216797977-e6fe2f93-1aba-48df-a28c-6f8820c0110d.png">


This pull request improves it (in my opinion), making it look like this instead:

<img width="633" alt="image" src="https://user-images.githubusercontent.com/122238526/216798026-3de49a5b-2258-473c-ba8c-95eadf41456c.png">

This is one of a family of docstrings that is generated, so they are all affected by my change.  For consistency I made the change for both the comparison and equivalence operators.  

I think in the case of a operator that is multiple words ('less than or equal to') the italics improve readability.  However, if we look at an operator that is only one word ('subtract') the capital letter is still gone, but the italics probably don't contribute to readability (but don't do any harm either).  Before/after my change shown below.

<img width="628" alt="image" src="https://user-images.githubusercontent.com/122238526/216798166-7964717b-f1b8-4edf-bed3-66b506832dab.png">

<img width="608" alt="image" src="https://user-images.githubusercontent.com/122238526/216798195-41bd0cc4-b041-4d87-9ebb-d1c671e782b0.png">


Putting this out there as an idea more than anything - I think this improves readability but would like to hear what others think. Thanks!





Labels:
name: Docs
name: Stale

Comments:
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.
DOC: fix various typos in plotting documentation
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: Docs
name: Visualization
description: plotting

Comments:
thx @partev
CI: unpin pyarrow, fix failing test
State: closed

- [x] closes #51146
- [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.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Unpins pyarrow and fixes `test_from_sequence_of_strings_pa_array` which was xfailed for pyarrow duration types.

pyarrow 11.0 introduces support for casting from duration to string:

```
In [4]: pa.array([1], type=pa.duration("s")).cast(pa.string())
Out[4]: 
<pyarrow.lib.StringArray object at 0x7f77ed6cc9a0>
[
  "1"
]
```

pyarrow < 11.0 raises:
```
ArrowNotImplementedError: Unsupported cast from duration[s] to utf8 using function cast_string
```


Labels:
name: CI
description: Continuous Integration
name: Arrow
description: pyarrow functionality

Comments:
Thanks @lukemanley 
I guess we should add 11 to our build matrix?
Good point. Otherwise 11 is only running on the macos and windows builds. Want to open a PR?
BUG: PandasArray.astype use astype_nansafe
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: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
Thanks @jbrockmendel
API: rename pandas/core/generic.py -> pandas/core.ndframe.py
State: closed

IMO `generic.py` is a very anonymous name and it would be better to have the more descriptive name `ndframe.py`.

`core/generic.py` will still exist, but will emits a deprecation warning if used/imported from. I've added a deprecation test in `pandas/tests/ndframe/test_frame_and_series.py`.



Labels:

Comments:
is pandas.core.generic user-facing? if not, then this will complicate looking through histories of lines (e.g. with `git log -G`)
We can't do this right now, core is only semi private. 

If we want to change things here, we have to deprecate and make it private first
Hm, yeah, I thought renamed files maintain their git history, but it looks like they don't (at least `git log -p -- pandas/core/ndframe.py` doesn't), so I guess this PR has a bigger trade-off than I thought when I made it. 

I guess unless there is agreement to the cost of this change (losing git history) is worth it, I'll have to close the PR again. I'll leave this open for a while for discussion just in case.
Independent of the git history, we can't do this right now.

We would have to deprecate core first before we can move stuff around
Actually as I suspected, git history is actually preserved and you can see the git history  by using the ``--follow``parameter, e.g.  ``git log -p --follow HEAD~100..HEAD -- pandas/core/ndframe.py``. OF course, people may forget/not know about `--follow`, so there's that negative aspect.

@phofl, my plan is to make *two* PRs in order to maintain git history AND go through a proper deprecation cycle, so this change could be backward compatible as per our normal rules. I've upload the second PR in order to show what I planned (see #51173). If you look at these two PRs as a whole, you'll see it is backward compatible (i.e. the `pandas.core.generic` is deprecated) and git history is preserved (using ``--follow``).
I am -1 as is.

The general idea is to deprecate core as a whole, technically it is already considered private (https://pandas.pydata.org/docs/reference/index.html)

There is already an open issue about it with lots of discussion:
https://github.com/pandas-dev/pandas/issues/27522

Renaming the file and pointing downstream libraries/users to another file when we might want to deprecate the whole module is not a good idea. A bad name is not a strong enough reason to cause all these disturbances and confusing side effects imo.
Ok no worries, I'll close the PRs. I can see that the core` discussion superceeds this issue.
Closing based on comments.
Happy to rename generally, but we have to make a decision for the core deprecation first
BUG: pd.array failing to raise with DataFrame
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: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
thx @jbrockmendel
REF: Resampler subclasses remove unused arg, ensure parent is not None
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: Resample
description: resample method
name: Clean

Comments:
thx @jbrockmendel
BUG: DataFrame.from_records with tzaware
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:
thx @jbrockmendel