BrandonFors/pandas-github-issues huggingface dataset:
REGR: shift raising for axis=1 and empty df
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: DataFrame
description: DataFrame data structure

Comments:
Thanks @phofl
DOC: fix PR02 errors in docstring for pandas.core.groupby.DataFrameGroupBy.rolling and pandas.core.groupby.SeriesGroupBy.rolling
State: closed

All PR02 Errors resolved in the following cases:

1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.DataFrameGroupBy.rolling
2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.SeriesGroupBy.rolling

- [x] xref https://github.com/pandas-dev/pandas/issues/57111
- [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.
- [ ] 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: Code Style
description: Code style, linting, code_checks

Comments:
Thanks @jordan-d-murphy
REGR: merge with 3rd party EA's can sometimes raise ValueError
State: closed

- [x] closes #57316
- [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/v2.2.1.rst` file if fixing a bug or adding a new feature.


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Regression
description: Functionality that used to work in a prior pandas version

Comments:
Thx @lukemanley 
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 2.2.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 2e0ef79dd48b13045ff3539df895c3b647c25403
```

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

```
git commit -am "Backport PR #57333: REGR: merge with 3rd party EA's can sometimes raise ValueError"
```

4. Push to a named branch:

```
git push YOURFORK 2.2.x:auto-backport-of-pr-57333-on-2.2.x
```

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

> "Backport PR #57333 on branch 2.2.x (REGR: merge with 3rd party EA's can sometimes raise ValueError)"

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).
CLN: Enforce deprecation of Series.agg using Series.apply
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.

Ref: #53325

cc @topper-123 

Labels:
name: Clean
name: Apply
description: Apply, Aggregate, Transform, Map

Comments:
thx @rhshadrach
CLN: Enforce change in default value of observed
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.

Ref: #51811

Labels:
name: Groupby
name: Categorical
description: Categorical Data Type
name: Clean

Comments:
thx @rhshadrach
REGR: CategoricalIndex.difference with null values
State: closed

- [x] closes #57318
- [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/v2.2.1.rst` file if fixing a bug or adding a new feature.


Labels:
name: Regression
description: Functionality that used to work in a prior pandas version
name: Categorical
description: Categorical Data Type
name: setops
description: union, intersection, difference, symmetric_difference

Comments:
thx
Enforce silent downcasting deprecation
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: Clean

Comments:
Thanks @phofl 
https://github.com/pandas-dev/pandas/issues/57403
CoW: Remove copy-keywords as far as possible
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.

This is a preparation for deprecating copy and also cleaning up unused branches now

Labels:
name: Copy / view semantics

Comments:
Thanks @phofl
CoW: Remove remaining occurrences from CoW
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: Copy / view semantics

Comments:
Thanks @phofl
REGR: Fix astype conversion of ea int to td/dt with missing values
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.

cc @lukemanley 

it should be covered by the other whatsnew

Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: NA - MaskedArrays
description: Related to pd.NA and nullable extension arrays

Comments:
LGTM
Thanks @phofl
DOC: fix PR02 errors in docstring for pandas.Series.str.wrap
State: closed

All PR02 Errors resolved in the following cases:

1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.str.wrap

- [x] xref https://github.com/pandas-dev/pandas/issues/57111
- [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.
- [ ] 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: Code Style
description: Code style, linting, code_checks

Comments:
I've updated the signature of wrap  but now some of my tests are failing, I'll need to fix this before you take another look @mroeschke 
@mroeschke ready for your review when you get a chance
pre-commit.ci autofix


Thanks @jordan-d-murphy
BUG: Fix near-minimum timestamp handling
State: closed

- [x] closes #57150 
- [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.

Previously, timestamps `1677-09-21 00:12:43.145224193` thru `1677-09-21 00:12:43.145224999` would raise an `OverflowError` due to the fact that `scaleMicrosecondsToNanoseconds` overflows as an intermediate step. After adding back the nanoseconds part, the timestamp would be valid again.

Labels:
name: Regression
description: Functionality that used to work in a prior pandas version
name: Timestamp
description: pd.Timestamp and associated methods

Comments:
@WillAyd where would I add tests for this? If I'm not mistaken, then the `npy_datetimestruct_to_datetime` function is never tested directly. Should I use the reproducible example in the original issue or come up with a narrower test?
> @WillAyd where would I add tests for this? If I'm not mistaken, then the `npy_datetimestruct_to_datetime` function is never tested directly. Should I use the reproducible example in the original issue or come up with a narrower test?

I'll fix the failing Windows tests and found in the documentation some guidance on where and how to add the tests. Will mark ready for review once done.
Heads up - I won't be able to review in detail until early next week
I have started over with a failing test, see the results on https://github.com/pandas-dev/pandas/pull/57314/commits/b4c825da2f87131b379ee81119ccdc3ba8237fec.

To resolve, I went with a minimally invasive approach that just checks for negative extreme before scaling to microseconds, and then doing the calculation backwards from the minimum valid timestamp. I didn't find any constant defined for this (`NPY_MIN_INT64 + 1`), so instead of polluting the global namespace in `np_datetime.h`, I went with a local variable. This is probably compile-time optimized, so I expect no overhead by doing it this way.

I only fixed the nanosecond case, because I was unable to devise tests for any other unit that would trigger this overflow, because:

1. any datetime string is parsed by `dateutil`, which seems to hiccup when trying to parse dates like `-290308-12-21T19:59:05.224193` (the minimum valid microsecond timestamp, for example). So coarser resolutions than `ns` wouldn't work.
2. for finer resolutions than `ns`, I was not sure how to execute the code paths, as the pandas timestamps seem to default to `ns` always, thus exiting at the branch that this PR fixes. Also, `np_datetime.pyx` says: `# AS, FS, PS versions exist but are not imported because they are not used.`
Thanks @robert-schmidtke
Fixing multi method for to_sql for non-oracle databases
State: closed

- [ ] closes #57310
- [ ] [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/v2.2.1.rst` file if fixing a bug or adding a new feature.


Labels:
name: Regression
description: Functionality that used to work in a prior pandas version
name: IO SQL
description: to_sql, read_sql, read_sql_query

Comments:
Totally fair not to accept dialect specific changes, but with the previous commit, ALL queries using the method="multi" argument resolve to insertion via single row. Is it worth breaking this functionality just for the sake of the Oracle connector?
I think it's reasonable to revert https://github.com/pandas-dev/pandas/pull/51648 that broke this for all `method="multi" ` queries. Would you be interested in making a PR to do that?
Yes, I definitely can make that PR, should I keep it in this PR and just change it or make a new one?
Also, is it worth making a warning at least for Oracle?
> Yes, I definitely can make that PR, should I keep it in this PR and just change it or make a new one?

Sure you can revert the code change in this PR. It would be good to add a unit test as well so it doesn't break again (`test_sql.py`)

>  Also, is it worth making a warning at least for Oracle?

Yeah in the docstring of `to_sql` that would be great
Looking good but please run the pre-commit checks to fix style issues: https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#pre-commit
Thanks @kassett
TST: adds a test to check signedness preservation after sum
State: closed

- [x] closes #37491
- [x] Tests added and passed
- [x] All code checks passed

Adds a test to make sure the result of sum does not alter the signedness of the input.

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

Comments:
I removed the unnecessary test and added the issue number :)
Thanks @banorton
DOC: fix PR02 errors in docstring for pandas.core.groupby.DataFrameGroupBy.hist
State: closed

All PR02 Errors resolved in the following cases:

1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.DataFrameGroupBy.hist

- [x] xref https://github.com/pandas-dev/pandas/issues/57111
- [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.
- [ ] 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

Comments:
@mroeschke  can you review my updated example for df.groupby().hist() when you get a chance?
Thanks @jordan-d-murphy
DEPR: Enforce deprecation of previous implementation of DataFrame.stack
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.

Ref: https://github.com/pandas-dev/pandas/issues/53515

We need to keep the `future_stack` argument in 3.0, but have two choices: still allow users to specify `future_stack=False` (while always seeing the warning message) or remove `future_stack=False` entirely now. In either case, we'd introduce a deprecation of the `future_stack` argument (regardless of how it's being specified) as part of 3.x (I plan on 3.1). 

I went with the former option of still allowing `future_stack=False` - it seemed more gradual.

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

Comments:
> We need to keep the `future_stack` argument in 3.0

that's unfortunate.
Also were you thinking of deprecating `dropna` and `sort` in this PR as well?
> Also were you thinking of deprecating `dropna` and `sort` in this PR as well?

Currently if you use `future_stack=True` we raise when dropna or sort are specified. So I don't think any action needs to be taken here.
OK but in a follow up they will be deprecated then? I see from the 2.1 whatsnew

> As such, the arguments dropna and sort are not utilized and must remain unspecified when using future_stack=True. These arguments will be removed in the next major release.
I don't think there is a need to deprecate them - they must remain unspecified and so removing them is backwards compatible. In other words, if you run pandas 2.x (or 3.x) without any warnings, then your code will be fine in 4.0.
> So in 4.0 we can just remove `sort` and `dropna` from the signature of `stack`?

Correct.
Thanks @rhshadrach
CLN: remove from PeriodIndex.asfreq unnecessary raising ValueError for invalid period freq
State: closed

xref #56945

removed from `PeriodIndex.asfreq` unnecessary raising ValueError for invalid period freq. Now we raise this ValueError for invalid period freq in `to_offset`.

Labels:
name: Frequency
description: DateOffsets
name: Clean

Comments:
@MarcoGorelli, could you please take a look at this PR?
BUG: sort_index(1, ignore_index=True, ascending=False)
State: closed

- [ ] closes #57293 (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: Bug

Comments:
thx
BUG: Updated _pprint_seq to use enumerate instead of next
State: closed

This PR closes an edge-case [bug](https://github.com/pandas-dev/pandas/issues/16098) that has been around for almost 7 years.

To print a DataFrame, the function `_pprint_seq()` constructs a string representation of an iterable object (called `seq`) by creating an iterator over it, and truncating it if `len(seq) > max_seq_items`.

However, a pandas `DataFrame` is an example of an object where `len(seq)` is _not_ a valid way of checking the length of the iterator. Specifically, `len(df)` returns the number of rows, while `iter(df)` iterates over the columns. When trying to print a DataFrame with more rows than columns, this raises a `StopIterator` exception.

This PR fixes this bug by explicitly iterating over the object, rather than assuming that `len(seq)` is equal to the number of items in the object. The new test `test_nested_dataframe()` raises an exception on `main`, but passes on this branch.

- [x] closes #16098
- [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 [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) (no new arguments/methods/functions).
- [x] Added an entry in `doc/source/whatsnew/v3.0.0.rst`.


Labels:
name: Bug
name: Output-Formatting
description: __repr__ of pandas objects, to_string

Comments:
thx @cliffckerr
DOC: fix PR02 errors in docstring for pandas.core.groupby.SeriesGroupBy.apply
State: closed

All PR02 Errors resolved in the following cases:

1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.SeriesGroupBy.apply

- [x] xref https://github.com/pandas-dev/pandas/issues/57111
- [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.
- [ ] 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

Comments:
@mroeschke can you confirm the alignment looks correct now?
Yup, I just did. Checks should be running again. Thanks for letting me know! 
pre-commit.ci autofix
Nice thanks for the quick turnaround @jordan-d-murphy