BrandonFors/pandas-github-issues huggingface dataset:
Remove downcast from Index.fillna
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.

I think this is covered by the other whatsnews

Labels:
name: Clean

Comments:
Thanks @phofl
DOC: fix SA05 errors in docstrings for pandas.PeriodIndex.asfreq, arr…
State: closed

…ays - ArrowStringArray, StringArray

- [x] xref #57392 
- [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:
Thanks @williamking1221
DOC: fix SA05 errors in docstring for pandas.DataFrame - agg, aggregate, boxplot
State: closed

All SA05 Errors resolved in the following cases:

1. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.DataFrame.agg
2. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.DataFrame.aggregate
3. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.DataFrame.boxplot


- [x] xref https://github.com/pandas-dev/pandas/issues/57392
- [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:
Thanks @jordan-d-murphy
BUG: wrong future Warning on string assignment in certain condition
State: closed

- [ ] closes #56503 (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.

is this it? finally? 🤞 

Labels:
name: Warnings
description: Warnings that appear or should be added to pandas
name: PDEP6-related
description: related to PDEP6 (not upcasting during setitem-like Series operations)

Comments:
Thanks @MarcoGorelli
CI: Format rst code blocks with blacken-docs
State: closed

- [ ] closes #46865
- [ ] [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: CI
description: Continuous Integration
name: Code Style
description: Code style, linting, code_checks

Comments:
What's the plan with this @tqa236? Are the problems in the CI a blocker to move forward with this?
hi @datapythonista, this problem is not related to the recent broken CI, although the broken CI indeed doesn't help testing or exploring.

The exact issue that prevents us from having a green CI is just the number of new lines in some code blocks in the doc where `black` enforces the new lines but `ipython` raises a warning there, which are treated as errors per our configuration. This warning doesn't affect the build, as the rendered doc still looks correct.

The approach I'm exploring now is a way to disable this warning by passing `ipython_warning_is_error=False` to silent this warning while still keeping other `sphinx` warning. 

I raised the issue [here](https://github.com/ipython/ipython/issues/14333) and [here](https://github.com/ipython/ipython/issues/14334) as well, but any quick change seems unlikely.

If you can point me to where I can pass `jupyter` or `sphinx` config to the build, it would be a great help.
Thanks for the update @tqa236.

I can't find the warnings in the doc build, are they still happening?

Configuration changes should be placed in `doc/source/conf.py`, I see an `nbsphinx` option to control the warnings: https://nbsphinx.readthedocs.io/en/0.9.3/configuration.html#suppress_warnings

I don't fully understand why ipython/nbsphinx should complain about blank lines, they shouldn't validate the style or format that I know, just execute the code. I can have a look if you can point me to the warnings that are making the CI fail, I only see an error I think I saw in other PRs about the section underlines.

CC @MarcoGorelli in case you have any opinion here.
thanks for pointing me to the conf file, @datapythonista. I'm able to pass the IPython config to the sphinx build now. 

Unfortunately, my approach doesn't work yet, as a warning is still raised, and sphinx will fail the build because of that. 

I'll need to think of another solution.
closed as I don't know how to proceed yet.
Fix for issue #57268 - ENH: Preserve input start/end type in interval…
State: closed

…_range

- [ ] closes #57268 
- [ ] [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
name: Interval
description: Interval data type

Comments:
> ew note in `v3.0.0.rst` and a unit test.
> 
> Also could you fix this for float types too?

Can you give me an example for float type with expected results? Thank you!
I have added my implementations for supporting float types. But I see in base.py that pandas doesn't support float16 data types. Should I convert them to float64 or just let pandas thow Exception?

base.py:
```python3
elif dtype == np.float16:
    # float16 not supported (no indexing engine)
    raise NotImplementedError("float16 indexes are not supported")
```

For example:

```python3
interval_index_float = pd.interval_range(start=np.float32(0.0), end=np.float32(0.6), freq=0.5, closed="left")
print(interval_index_float)
```

Gives:

```
IntervalIndex([[0.0, 0.5)], dtype='interval[float32, left]')
```

But:

```python3
interval_index_float = pd.interval_range(start=np.float16(0.0), end=np.float16(0.6), freq=0.5, closed="left")
print(interval_index_float)
```

will raise:

`NotImplementedError: float16 indexes are not supported`

I have added implementation to ignore float16 like this and checked-in my changes. If you want to let it throw an exception let me know!

My implementation:

```python3
if isinstance(start, float | np.float16) or isinstance(
                end, float | np.float16
            ):
    dtype = np.dtype("float64")
else:
    dtype = start.dtype if start.dtype == end.dtype else np.dtype("float64")
breaks = np.arange(start, end + (freq * 0.1), freq, dtype=dtype)
```

Current implementation safely returns float64 if it finds float16, Just like current main release!


Changes have been completed as you asked!
Thanks @VISWESWARAN1998 
You are most welcome @mroeschke !
TST: Add missing skips for unavailable pyarrow
State: closed

The `all_parsers` fixture has this check, but some of the other fixtures were missing it.

- [n/a] 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
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [n/a] 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: Testing
description: pandas testing functions or related to the test suite
name: Stale
name: Arrow
description: pyarrow functionality

Comments:
Given #54466, this is primarily targeted at getting backported to 2.2.x.
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.
This isn't waiting for me, AFAICT.
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.
Again, it was [waiting for you to reply](https://github.com/pandas-dev/pandas/pull/57397#discussion_r1488731996).
OK sorry I missed that. Could you resolve the merge conflict?
It appears another PR fixed the problem this PR was trying to solve. Sorry we weren't able to get this in in the meantime, but closing this PR out.
BUG: Ensure consistent kwarg only restriction on df.any and df.all
State: closed

- [x] closes #57087 
- [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: Stale
name: Reduction Operations
description: sum, mean, min, max, etc.

Comments:
Oh, my bad, okay 👌
Gotta learn about deprecating
> Gotta learn about deprecating

Luckily, it is quite simple:

1) you decorate the method with this:
`@deprecate_nonkeyword_arguments(version="3.0", allowed_args=["self"], name="all")`
where `name` is the name of the method.

2) Add a whatsnew entry

3) Ideally, have a test (not sure whether that is needed)

These deprecations apply to both DataFrame and Series for at least the following methods: any, all, min, max, mean, median, sum, prod, std, var, sem, skew, kurt.


I had [similar changes in this PR](https://github.com/pandas-dev/pandas/pull/56739/commits/9de4f705f4ea170ae5aca64fddc704ef51db4905#diff-421998af5fe0fbc54b35773ce9b6289cae3e8ae607f81783af04ebf1fbcaf077) but removed them from the PR to keep it easier to merge. Feel free to have a look at that PR to see how to adjust some of the tests (some of them will fail when you deprecate positional arguments).

> Luckily, it is quite simple:

Thank you for explaining, this is super helpful! 👍
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
TST: Fix test_str_encode on big endian machines
State: closed

I couldn't find a way to specify the endianness when creating the `ArrowDtype`, so just pick the right result based on native byte order.

- [x] closes #57373 (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).
- [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [n/a] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

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

Comments:
Sure thanks @QuLogic
TST: Fix IntervalIndex constructor tests on big-endian systems
State: closed

Two tests cases specify the expected data to be little-endian. However, none of the other cases do so, and the test creates native endian data, causing these tests to fail only in these specific cases.

- [n/a] 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
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [n/a] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


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

Comments:
Thanks @QuLogic
Fix evaluations on Python 3.12
State: closed

List comprehensions no longer get their own scope [1], so adding a level to the (eventual) call to `sys._getframe` goes outside the actual caller. If running in `pytest` (so that there is a scope outside the caller), you end up looking in some unrelated scope. If you are running a script, then `sys._getframe` raises an error that the level is out of bounds.

The `Bitwise operations` warning in `test_scalar_unary` appears to always be raised, so remove the condition.

[1] https://docs.python.org/3.12/whatsnew/3.12.html#whatsnew312-pep709

I'm not entirely sure why neither issue is seen on CI, but there are so many tests/workflows, I'm also not sure which one to check. I guess I'll see how this goes in this PR.

- [n/a] 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
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


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

Comments:
OK, so tests on CI are failing with the change to the warning condition. _However_, if you check [the logs for `main`](https://github.com/pandas-dev/pandas/actions/runs/7880360042/job/21502267281#step:8:51), it seems like the warning is raised, but from a weird spot that isn't caught:
```
/home/runner/micromamba/envs/test/lib/python3.12/site-packages/coverage/parser.py:402: DeprecationWarning: Bitwise inversion '~' on bool is deprecated. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.
  self.code = compile(text, filename, "exec", dont_inherit=True)
```
This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.
Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.
TST: Ensure Matplotlib is always cleaned up
State: closed

The seaborn test also uses Matplotlib but was not wrapped in the cleanup fixture, As there are now 3 files that need this fixture, refactor to reduce code duplication.

The leftover figure from `test_seaborn` would cause a DeprecationWarning from Matplotlib 3.8 for closing the figures on the backend change (from the `mpl.use("template")` in the fixture), but this probably depends on if pytest chose to run it before the other tests or not.

- [n/a] 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
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


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

Comments:
Thanks @QuLogic
BUG: map(na_action=ignore) not respected for Arrow & masked types
State: closed

```python
In [5]: df = DataFrame({"a": [1, NA, 2], "b": [NA, 4, NA]}, dtype="Int64")

In [6]: df.map(lambda x: 42, na_action="ignore") # pd.NA's lost
Out[6]: 
    a   b
0  42  42
1  42  42
2  42  42
```

Labels:
name: NA - MaskedArrays
description: Related to pd.NA and nullable extension arrays
name: Arrow
description: pyarrow functionality

Comments:
thx @mroeschke
CLN: ._data, PeriodIndex arguments
State: closed

xref https://github.com/pandas-dev/pandas/pull/52003, https://github.com/pandas-dev/pandas/pull/55963

Bumped fastparquet as they updated their `_data` usage in https://github.com/dask/fastparquet/commit/7d9703b82090c5fc8ae3b013ae558f3b06fa287c

Labels:
name: Clean

Comments:
Going to merge but can follow up if needed
DOC: add an example to `PeriodIndex.to_timestamp` to clarify the behavior in case len(index)<3
State: closed

xref #56213

added an example to `PeriodIndex.to_timestamp` to clarify the behavior in case `len(index) < 3`

Labels:
name: Docs

Comments:
@MarcoGorelli, I added an example to clarify the behavior of `PeriodIndex.to_timestamp` in case `len(index) < 3`. Could you please take a look at this PR?
DEPR: Positional arguments in Series.to_string
State: closed

- [X] closes #57280
- [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: IO Data
description: IO issues that don't fit into a more specific label
name: Deprecate
description: Functionality to remove in pandas

Comments:
@mroeschke Pinging on green
Looking good! You can already make the two overloads keyword-only, if you want to:

```py
    @overload
    def to_string(
        self,
        buf: None = ...,
        *,
        na_rep: str = ...,
```
@twoertwein It looks like the two overloaded methods are already keyword only. Is there something specific I need to do?
> Is there something specific I need to do?

Just need to add two `*,`

```py
    @overload
    def to_string(
        self,
        buf: None = ...,
       *,  # add this
        na_rep: str = ...,

    @overload
    def to_string(
        self,
        buf: FilePath | WriteBuffer[str],
       *, # add this
        na_rep: str = ...,

    @deprecate_nonkeyword_arguments(
    def to_string(
```
@twoertwein Pinging on green. 

BTW I didn't know that you can use `*` to mandate the use of keyword args after the `*`. I learned something new today!
Thank you @rmhowe425 !
update intiger_na.rst document file
State: closed

- [x] closes #49201 
- [ ] [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
Thanks for the PR but this is actively being worked on in https://github.com/pandas-dev/pandas/pull/57050 so closing in favor of that open PR. Can reopen this one if the other one goes stale