BrandonFors/pandas-github-issues huggingface dataset:
fix negative n for str.replace with arrow string
State: closed

- [ ] closes #56404 (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:
You mean raise if n <= -2? (since n=-1 on the docs means unlimited), I can make that change, but I was trying to follow the behavior of pd.StringDtype(), which seems like it allows any negative value to be unlimited.
Ah that's fine then
thx @rohanjain101 
This should probably be the same for ArrowStringArray._str_replace?
DOC: add deprecation of chained assignment to 2.2 whatsnew
State: closed

Part of the warnings we have been adding in https://github.com/pandas-dev/pandas/issues/56019, specifically the ones for chained assignment / chained inplace methods, are already being raised in the default mode, because this is a part of the changes with CoW we can clearly deprecate in advance. 
Therefore adding a whatsnew section about this.


Labels:
name: Docs
name: Copy / view semantics

Comments:
thx @jorisvandenbossche
TYP: tighter typing in _maybe_convert_freq, _from_ordinal
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).
- [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.


Labels:
name: Period
description: Period data type
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
Thanks @jbrockmendel
DEPR: Series[categorical].replace special-casing
State: closed

- [x] closes #55147 (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
- [ ] 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: Categorical
description: Categorical Data Type
name: Deprecate
description: Functionality to remove in pandas
name: replace
description: replace method

Comments:
Thanks @jbrockmendel 
Is there any use case for categorical replace now? I guess not? Except if you try to replace non-existing values?
TST: Added a test for groupby.prod
State: closed

- [x] Closes #46573 

- The bug related to issue #46573  has been fixed in the current version.

- Added a test related to this issue. The test is designed to check if `groupby.prod` returns the same results as `prod`.


Labels:
name: Bug
name: Groupby
name: Needs Tests
description: Unit test(s) needed to prevent regressions
name: Reduction Operations
description: sum, mean, min, max, etc.

Comments:
Hi @rhshadrach , thank you for your review and suggestions. I have updated the code based on your feedback. Please review. Appreciate your help and guidance!
Thanks @ccccjone!
[DOC]: Documentation updated for codes
State: closed

- [X] closes #56278(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



Labels:

Comments:
Thanks but since this is very similar to https://github.com/pandas-dev/pandas/pull/56278 I suggest combining your changes in that PR so closing this one
BLD: Refresh gitpod build files
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: CI
description: Continuous Integration
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.
Going to close to clear the queue, but feel free to reopen if you want to circle back
TYP: require_matching_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: Typing
description: type annotations, mypy/pyright type checking

Comments:
Thanks @jbrockmendel
PERF: datetimelike addition
State: closed

```
In [1]: import pandas as pd

In [2]: dti = pd.date_range("2016-01-01", periods=10_000)

In [3]: td = pd.Timedelta(days=1)

In [4]: %timeit dti + td
108 µs ± 1.85 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)  # <- main
94.3 µs ± 3.27 µs per loop (mean ± std. dev. of 7 runs, 10,000 loops each)  # <- PR
```

Labels:
name: Performance
description: Memory or execution speed performance
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
Thanks @jbrockmendel
BUG: rolling with datetime ArrowDtype
State: closed

- [x] closes #55849 (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).
- [ ] 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.

Additionally renamed _apply_blockwise to _apply_columnwise to fit the actual methodology

Labels:
name: Datetime
description: Datetime data dtype
name: Window
description: rolling, ewma, expanding
name: Arrow
description: pyarrow functionality

Comments:
Since there's no more comments here going to merge. Can follow up if needed
Update nlargest nsmallest doc
State: closed

- [x] closes #45041 (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

Comments:
@rhshadrach thanks for the review, here is the new commit as requested.
@MainHanzo - pre-commit is failing with `black`. If you aren't familiar with pre-commit, see here:

https://pandas.pydata.org/pandas-docs/stable/development/contributing_codebase.html#pre-commit
@rhshadrach it’s all right now
Thanks @MainHanzo
BUG: `concat` should keep series names unless `ignore_index=True`
State: closed

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


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

Comments:
Thanks @rob-sil
Implicity convert series to DataFrame before doing the concatenation …
State: closed

…(#56257)

- [ ] 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 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.
WIP BUG: Warning for incompatible type when type should be compatible
State: closed

- [ ] closes #55990 (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: Stale
name: PDEP6-related
description: related to PDEP6 (not upcasting during setitem-like Series operations)

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.
BUG: Replaced ValueError exception with TypeError exception in df.where() function
State: closed


Replaced ValueError exception with TypeError as it is more appropriate for the error it serves

- [] closes issue #56330 where there was a consensus that a TypeError is more appropriate for the following error: "Boolean array expected for the condition, not (non-bool type)". Since ValueErrors are raised when the type is correct but the value is incorrect, whereas in this function we are raising an exception because of a wrong type, hence the TypeError.


Labels:
name: Bug
name: Error Reporting
description: Incorrect or improved errors from pandas

Comments:
Thanks for the PR! Looks like the tests need adjusted too.
Yeah I'm super confused because I literally only changed two keywords in the entire file and there was no way it messed up so much that 27 tests failed. Will I have to re-Pr this or will you guys fix the test stuff? Or do I need to change anything in my PR?
We test that the correct error message is raised, and you're changing that behavior. Here is an example of a failing test:

https://github.com/pandas-dev/pandas/actions/runs/7110780716/job/19357783827?pr=56358#step:8:1536

```
with pytest.raises(ValueError, match=msg):
    df.where(cond)
```

Your change now makes it so that a `TypeError` is raised, and so this test is now failing. The test needs to be updated to check for a `TypeError`.

ohh that actually makes a lot of sense. this is my first time contributing to a codebase (did some documentation work in the past) so I had no idea about the testing methods. Do I have to modify those tests in this PR or is that something that the moderators take care of?
> Do I have to modify those tests in this PR or is that something that the moderators take care of?

The tests need to be modified so that they're passing in this PR.
@DarthKitten2130 Are you still working on it?
Yeah actually I'm in the process of modifying the tests. Please do not close this PR I just haven't been finding the time.
BUG DataFrame.update(self, other,join: str = "left", overwrite: bool = True,filter_func=None,errors: str = "ignore"):
State: closed

- [ ] closes #55883 
- [ ] [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
- [Done ] 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 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.
ENH: Implement Series.interpolate for ArrowDtype
State: closed

- [x] closes #56267 (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).
- [ ] 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: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: Arrow
description: pyarrow functionality

Comments:
Going to merge this PR (as it only applies to a narrow set of interpolate), but happy to follow up
DEPR: lower/uppercase strings such as 'y', 'q', 'H', 'MIN', etc. denoting freqs/units for time series, period, and timedelta
State: closed

xref #52064, #54061

Deprecated lowercase strings in favour of uppercase strings denoting:

- period aliases weekly, monthly and bigger frequency
- offsets aliases representing `DateOffset` subclasses that are a week or bigger (``Week``, ``MonthBegin``, ``MonthEnd``, etc.)
- timedelta units for week, month or bigger

Deprecated uppercase strings in favour of lowercase strings denoting:

- period aliases hourly, minutely or smaller frequency
- offsets aliases representing `DateOffset` subclasses that are an hour or smaller (``Hour``, ``Minute``, etc.)
- timedelta units for hour, minute or smaller

Labels:
name: Frequency
description: DateOffsets
name: Deprecate
description: Functionality to remove in pandas

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.
shall we mark this as draft until we've enforced the deprecations already in?
> shall we mark this as draft until we've enforced the deprecations already in?

thank you, good idea. I marked this PR as draft.
partially closed via #59051 and #58998.
It's still allowed to use mixed cases such as: "Min", "Us", "uS", "Ns", etc.
PERF: join on unordered CategoricalIndex
State: closed

- [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.0.rst` file if fixing a bug or adding a new feature.

existing test: `test_join_with_categorical_index`


```
import pandas as pd
import numpy as np

categories = [f"cat_{i:03}" for i in range(1000)]

idx1 = pd.CategoricalIndex(np.repeat(categories, 1000), categories=categories)
idx2 = pd.CategoricalIndex(categories[100:200], categories=reversed(categories))

df1 = pd.DataFrame({"val1": 1}, index=idx1)
df2 = pd.DataFrame({"val2": 2}, index=idx2)

%timeit df1.join(df2)

# 129 ms ± 7.93 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)   -> main
# 28.4 ms ± 1.18 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)  -> PR
```

Labels:
name: Performance
description: Memory or execution speed performance
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Categorical
description: Categorical Data Type

Comments:
Thanks @lukemanley
TST: Remove groupby/test_function.py
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 finishes up the removal of test_function.py from the groupby tests. With the exception of `test_groupby_non_arithmetic_agg_int_like_precision` (which is moved to other files here), the tests that remained fall into two (and partially overlapping) camps:

 - Tests for `numeric_only`
 - Tests that use the fixture `groupby_func`, which goes over every groupby operation

For the first, the options I considered were creating `test_numeric_only.py` or split it up into various other files such as `test_reductions.py`, `test_cumlative.py`, and some others. Similarly, for tests that use `groupby_func` that don't fit in other files, I considered creating `test_all_methods.py` (which can be renamed to something better) or split up the tests into several different files.

I'm completely on the fence here. Breaking up a parameterized test and duplicating code across multiple files seems pretty bad. While I don't love having `test_all_methods` (it's sort of a catch-all), at first it seemed to me that it is less bad than breaking up the parameterized tests. But then grepping around, it appears that there are only three tests across all of groupby that would go in `test_all_methods`. Perhaps this is something we can expand on later - but maybe since there are so few tests it's okay to break these up?

Any ideas here are very much welcome.

cc @jbrockmendel @mroeschke 

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

Comments:
Thanks @rhshadrach 
> > Breaking up a parameterized test and duplicating code across multiple files seems pretty bad. While I don't love having test_all_methods (it's sort of a catch-all), at first it seemed to me that it is less bad than breaking up the parameterized tests.
> 
> IMO I think in the future this could be rolled into a potential refactor of `test_groupby.py` as a file testing "groupby scenarios that should work with all methods"

Sounds good - `test_groupby` is my next target; I've always been under the impression that tests here should be for something like "All groupby attributes that aren't ops and don't have a more specific location". E.g. `len(df.groupby(...))` or `df.groupby(...).groups`. I think it makes sense to roll `test_all_methods` into here.
DOC: add missing parameters to DateOffset classes: Milli, Micro and Nano
State: closed

- [ ] towards DOC:#52431

Updated documentation by 
1. adding missing parameters for offsets classes: Milli, Micro, Nano.
2. adding parameter description for offset classes: SemiMonthEnd, SemiMonthBegin


Labels:
name: Docs
name: Frequency
description: DateOffsets

Comments:
Could you fix the code checks?
Thanks @vinitaparasrampuria
Backport PR #56174: CI: Add 3.12 builds
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:
pre-commit.ci autofix
You'll need to add `-${{ matrix.pandas_copy_on_write || '' }}` to the end of the concurrency key otherwise some builds are getting canceled