BrandonFors/pandas-github-issues huggingface dataset:
Update test_ufunc.py
State: closed

refactor with chain constant value assignment to make code more Pythonic, concise and efficient.

- [ ] 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 not thanks, please check the good first issues if interested in contributing
Okay.
DEPR: Tick.delta
State: closed

- [x] closes #55498 (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: Frequency
description: DateOffsets
name: Deprecate
description: Functionality to remove in pandas

Comments:
Looks like there's usage of this in `timeseries.rst`
Thanks @jbrockmendel
DEPR: delim_whitespace kwd in read_csv
State: closed

- [ ] closes #xxxx (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: IO CSV
description: read_csv, to_csv
name: Deprecate
description: Functionality to remove in pandas

Comments:
Thanks @jbrockmendel
DEPR: verbose kwd in read_csv, read_table
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: IO CSV
description: read_csv, to_csv
name: Deprecate
description: Functionality to remove in pandas

Comments:
Thanks @jbrockmendel
CLN: replace unnecessary `freq_to_period_freqstr` with `PeriodDtype` constructor
State: closed

xref #52064

replaced `freq_to_period_freqstr()` with `PeriodDtype(freq)._freqstr` in ValueError message in the definition of `_shift_with_freq()`

Labels:
name: Frequency
description: DateOffsets
name: Clean

Comments:
I replaced `freq_to_period_freqstr` with `PeriodDtype(obj)._freqstr / PeriodDtypeBase(obj._period_dtype_code, obj.n)._freqstr`. Now we don’t need the `function freq_to_period_freqstr`, which is why I removed it.

One comment:
In `pandas/core/arrays/period.py` in the definition of `raise_on_incompatible` I added
```
with warnings.catch_warnings():
    warnings.simplefilter("ignore")
```
because  otherwise the `test_maybe_convert_timedelta` (in `pandas/tests/indexes/period/test_period.py`) fail.

@MarcoGorelli, could you please take a look at this PR?
Thanks @natmokval
DOC: Remove 1.2 versionadded and changed
State: closed

Lets see if the docs build like this

Labels:
name: Docs

Comments:
Was curious about recent PyPI downloads - here they are for the last 30 days and 365 days respectively after stripping off the patch version.

```
# Last 30 days
         num_downloads       pct
version                         
2.1           37113461  0.242764
1.3           27127663  0.177446
2.0           21945922  0.143551
1.5           21767650  0.142385
1.1           12604581  0.082448
1.2           11386654  0.074482
1.0            8958391  0.058598
1.4            5990242  0.039183
0.24           2742404  0.017938
0.25           1985167  0.012985
0.22            506227  0.003311
0.23            466675  0.003053
0.20             94863  0.000621
0.19             80029  0.000523
0.21             50860  0.000333
0.18             30623  0.000200
0.17              6348  0.000042
0.16              4729  0.000031
0.15              3692  0.000024
0.14              1846  0.000012

# Last 365 days
         num_downloads       pct
version                         
1.3          323629530  0.213405
1.5          263981724  0.174073
2.0          213161185  0.140561
1.1          183277328  0.120855
1.2          142029794  0.093656
2.1          110269020  0.072713
1.0           97492902  0.064288
1.4           83294693  0.054926
0.24          42107295  0.027766
0.25          37070776  0.024445
0.23           9389390  0.006191
0.22           5793919  0.003821
0.20           2013760  0.001328
0.19           1245090  0.000821
0.21            721957  0.000476
0.18            374775  0.000247
0.17            172063  0.000113
0.16             81421  0.000054
0.15             61217  0.000040
0.7              55964  0.000037
```
We can't keep these notes around forever, folks can just use the version switch if they are still back on 1.3. 1.3 was released 2 years ago and this will land in the 5th release since then
Thanks @phofl
REF: avoid special-casing in agg_series
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

Comments:
Thanks @jbrockmendel
TYP: _json.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.


Labels:
name: IO JSON
description: read_json, to_json, json_normalize
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
Thanks @jbrockmendel
Support multiplication of pd.ArrowDtype(pa.string()) and integral value where integral value is a series
State: closed

- [ ] closes #56537(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: Strings
description: String extension data type and string data
name: Arrow
description: pyarrow functionality

Comments:
Thanks @rohanjain101
DEPR: object inference in to_stata
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.

The "do X instead" won't actually work until 3.0, so this has to wait until then (and can't write the whatsnew until the 3.0 file exists). Putting this here so I don't forget about it.

Labels:
name: Deprecate
description: Functionality to remove in pandas
name: IO Stata
description: read_stata, to_stata

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.
Now that we have the `3.0.0.rst` file now, interested in following up?
Going to hold off until #55901 goes in
it looks like we don't have any test cases that get to the relevant path.  editing test_big_dates to use `expected.astype(object).to_stata` fails pretty badly; it looks like in the delta=True case by storing microseconds instead of milliseconds. 

two options: first is to change the relevant path to call infer_objects() and then recurse, second is to just rip out the now-identified-as-buggy path.  preferences?
Probably just take it out.  Simplicity is its own reward.

Still interested in finishing this @jbrockmendel ?
Thanks @jbrockmendel
Adjust format tests for new string option
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: Strings
description: String extension data type and string data

Comments:
Thanks @phofl
ENH: Add limit_area to ffill/bfill
State: closed

- [x] closes #56492 (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.

Only adds to Series/DataFrame. Using ffill/bfill in Resampler.interpolate is also deprecated, but it appears to be a bit more work in order to implement there. I've opened #56532 to track.

Labels:
name: Enhancement
name: Missing-data
description: np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
name: DataFrame
description: DataFrame data structure
name: Series
description: Series data structure

Comments:
Thanks @rhshadrach
BUG: pivot dropping wrong column level with numeric columns and ea dtype
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: Bug
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Strings
description: String extension data type and string data

Comments:
Thanks @phofl
Adjust crosstab tests for new string option
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: Strings
description: String extension data type and string data

Comments:
Thanks @phofl
DOC: Added docstrings to fixtures defined in XML I/O, util and pandas modules
State: closed

Partially addresses: #19159

Co-authored-by: @GeorgeJuniorGG and @MylenaRoberta.

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

Comments:
> Thanks for the contribution @CristianoS16, good work, I added some suggestions that you can have a look at. Note that I only add the suggestions once, but for example having the constant values `True` or `False` with backticks is something that can apply to several docstring in your changes.

Thanks @datapythonista for the suggestions. I think we fixed it!
Thank you @CristianoS16 for the contribution, nice work, and sorry for the delay.
REGR: groupby with Decimal and NA values
State: closed

- [x] closes #54847 (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
name: Groupby
name: Regression
description: Functionality that used to work in a prior pandas version
name: Sorting
description: e.g. sort_index, sort_values

Comments:
thx @rhshadrach
DEPR: groupby.grouper
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/pull/55738#discussion_r1426070370

This reverts the deprecation of `grouper.reconstructed_codes` and `grouper.group_keys_seq` from #56149 in favor of deprecating all of `grouper`.

Labels:
name: Groupby
name: Deprecate
description: Functionality to remove in pandas

Comments:
Thanks @jbrockmendel - changes made.
thanks @rhshadrach 
@rhshadrach one usage of this that I noticed in downstream (seaborn, https://github.com/mwaskom/seaborn/pull/3615, https://github.com/mwaskom/seaborn/blob/a3cb0f1b33551eb25fed1907d0abdd0237fac215/seaborn/categorical.py#L640) is to access the `result_index`. 

Do we have a good alternative for that?
One could do something like `pd.Index(grouped.indices.keys())`, but that's less robust (converts from python scalars)

I haven't followed the PR where you are refactoring `result_index`, so don't know if that will change anything (or only how it is calculated), but would we want to expose something similar on the groupby object itself as alternative?

Using `result_index` is not currently reliable:

```
df = pd.DataFrame(
    {
        "a": pd.Categorical([1], categories=[1, 2]),
        "b": pd.Categorical([1], categories=[1, 2]),
        "c": 5,
    }
)
gb = df.groupby(["a", "b"])
print(gb.grouper.result_index)
# MultiIndex([(1, 1)], names=['a', 'b'])
print(gb.size())
# a  b
# 1  1    1
#    2    0
# 2  1    0
#    2    0
# dtype: int64
```

though #55738 will fix this in all cases I know of. An alternative is to perform a reduction and take the index from the result. I recommend `size` for this as it doesn't require as much computation as other methods.

```
size = 100_000
df = pd.DataFrame({'a': np.random.randint(0, 100, size), 'b': np.random.randint(0, 100, size), 'c': np.random.random(size)})
%timeit df.groupby(['a', 'b']).size().index
# 3.68 ms ± 6.2 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
%timeit df.groupby(['a', 'b'])._grouper.result_index
# 3.36 ms ± 31.9 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
```

We do not need to deprecate `grouper` for #55738, only certain grouper attributes (see #56149)
CoW: Set a bunch of Series copy statements to False
State: closed

Because the default is now `copy=True` for numpy array input when CoW is enabled, we can explicitly disable copying when we know the data is newly generated.

Labels:
name: Copy / view semantics

Comments:
Thanks! Do you know if there are still many other places as well to further check this, or was this already the result of a more or less full search?
I searched in the past already,  I think we got most cases, but wouldn't guarantee 100% coverage
No 100% guarantee needed ;) Just to know if we need to actively track this as a further TODO item
I don't think so, but I reserve the right to change this statement when we switch over and see a bunch of regressions in the asvs :)
TYP: make dtype required in _from_sequence_of_strings
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.
- [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: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
> Error: /home/runner/work/pandas/pandas/pandas/core/arrays/base.py:334:EX03:pandas.api.extensions.ExtensionArray._from_sequence_of_strings:flake8 error: line 2, col 4: E121 continuation line under-indented for hanging indent

@mroeschke is this check new?  i dont see what it is complaining about
good suggestion, seems to have done the trick
This method is only ever called with a dtype object. There’s also a recent
issue about having a dedicated constructor for inference.

On Sat, Feb 3, 2024 at 2:02 PM Matthew Roeschke ***@***.***>
wrote:

> ***@***.**** commented on this pull request.
> ------------------------------
>
> In pandas/core/arrays/arrow/array.py
> <https://github.com/pandas-dev/pandas/pull/56519#discussion_r1477131965>:
>
> > @@ -316,7 +318,7 @@ def _from_sequence(
>
>      @classmethod
>      def _from_sequence_of_strings(
> -        cls, strings, *, dtype: Dtype | None = None, copy: bool = False
> +        cls, strings, *, dtype: ExtensionDtype, copy: bool = False
>
> At least for arrow, dtype=None was supposed to mean "let pa.array infer
> the type", and now that can't be done?
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/pandas-dev/pandas/pull/56519#pullrequestreview-1861128307>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AB5UM6A7CJGWIEV5TNHGKELYR2XXLAVCNFSM6AAAAABAW7H2RSVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNRRGEZDQMZQG4>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>

Thanks @jbrockmendel
CLN: remove unused entries from _lite_rule_alias
State: closed

xref #56346

remove unused entries `"min", "ms", "us", "ns"` from _lite_rule_alias

Labels:
name: Frequency
description: DateOffsets
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.
I tried to do something similar in https://github.com/pandas-dev/pandas/pull/59240 - fancy taking a look please?
> I tried to do something similar in #59240 - fancy taking a look please?

yeah, sure, I'll take a look.

I got the same idea, to move  aliases "us", and"ns" from` _lite_rule_alias` to `c_PERIOD_AND_OFFSET_DEPR_FREQSTR`. 

seems like all tests passes except some tests in `pandas/tests/tseries/offsets/test_offsets.py`.
closed as completed via #59240
TST: use one-class pattern in test_numpy
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: Testing
description: pandas testing functions or related to the test suite

Comments:
Thanks @jbrockmendel