BrandonFors/pandas-github-issues huggingface dataset:
DOC warn user about potential information loss in Resampler.interpolate
State: closed

In scientific and technical domain people deal with high-frequent or non-equidistant timeseries. Using `resample("1s").interpolate()` can have unwanted side effects which we should warn in the documentation:

```python
import datetime as dt
import pandas as pd
import matplotlib.pyplot as plt

timesteps = [
    dt.datetime(2023, 3, 1, 7, 0, 0),
    dt.datetime(2023, 3, 1, 7, 0, 1),
    dt.datetime(2023, 3, 1, 7, 0, 2),
    dt.datetime(2023, 3, 1, 7, 0, 3),
    dt.datetime(2023, 3, 1, 7, 0, 4)
]
series = pd.Series(data=[1, -1, 2, 1, 3], index=timesteps)

resample_freq = "400ms"
series_resampler = series.resample(resample_freq)
series_resampled_linear = series_resampler.interpolate("linear")
```
which leads to the following:

![result](https://user-images.githubusercontent.com/12762439/227719356-b3974634-ae19-40cc-8e0a-7ad668da76c4.png)

For that example, information loss is expected.

Imho we should warn the user about this behavior. It seems to be known, to quote @jreback from [here](https://github.com/pandas-dev/pandas/issues/14297#issuecomment-285434729):

> so the reason this happens is because the index is first reindexed to the new time buckets (upsampled) via reindexing, then interpolation happens.  


- [x] refers to #12552, #14297
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Docs
name: Resample
description: resample method

Comments:
Thanks, looks like some of our docstring validations are failing
@mroeschke let me know if something is missing/to be extended
Thanks @kopytjuk
WARN: Only warn about inconsistent parsing if there are multiple non-null elements
State: closed

- [ ] closes #52167 (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.

Not sure this needs a whatsnew note as it could just be considered part of the PDEP4 changes, which haven't yet reached user-facing status

The idea here is to only warn if there are at least 2 non-null elements - otherwise, a single element can't be inconsistently-parsed :) 

Labels:
name: Datetime
description: Datetime data dtype
name: Warnings
description: Warnings that appear or should be added to pandas

Comments:
Thanks @MarcoGorelli
BUG: Unexpected KeyError message when using .loc with MultiIndex in a possible edge-case
State: closed

- [x] closes #51892
- [ ] [Tests added and passed]
- [x] All [code checks passed]
- [ ] Added [type annotations]
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves

Comments:
Thx @jayendra-patil33
BUG: construct Timestamp with year out of pydatetime range
State: closed

- [x] closes #52091 (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.
- [ ] 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: Non-Nano
description: datetime64/timedelta64 with non-nanosecond resolution
name: Timestamp
description: pd.Timestamp and associated methods

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.
Closing to clear the queue, but feel free to reopen if you want to continue
REF/TYP: stricter typing for Series._slice
State: closed

Motivation is that Series._slice surprisingly accepts non-slice inputs.  Changing that required copying the slice-handling code from `DataFrame.__getitem__`, at which point it made sense to share that by implementing `NDFrame._getitem_slice`

Labels:
name: Refactor
description: Internal refactoring of code
name: Typing
description: type annotations, mypy/pyright type checking

Comments:
Thanks @jbrockmendel
BUG: fix dic_values update
State: closed

- [x] closes #52175 
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature. -> I'm not sure where I should put an entry: 1.x.x vs 2.x.x


Labels:

Comments:
Thanks for the PR but closing in favor of more discussion on the issue first
DEPR: subclassing Index
State: closed

- [x] closes #45289 (Replace xxxx with the GitHub issue number)
- [x] closes #15258
- [x] closes #37882
- [ ] [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.

This is just a docs change, removing the wording that suggests we explicitly support subclassing Index.  So it shouldn't break any implementations in the wild.

Labels:
name: Docs
name: Deprecate
description: Functionality to remove in pandas
name: Index
description: Related to the Index class or subclasses

Comments:
Thanks @jbrockmendel
DOC: Clarify difference between StringDtype(pyarrow) and ArrowDtype(string)
State: closed

Spawned from a discussion in #52156


Labels:
name: Docs
name: Arrow
description: pyarrow functionality

Comments:
Is there a plan to deprecate the older one and if so should that be mentioned here?
thx @mroeschke 

There is a discussion about deprecating this somewhere but no consensus yet.
Yeah the discussion started at https://github.com/pandas-dev/pandas/issues/48469
PERF: slicing
State: closed

```
import pandas as pd
ser = pd.Series(range(300_000))
df = ser.to_frame()

%timeit ser[:30]
14.6 µs ± 474 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)  # <- main
12.6 µs ± 421 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)  # <- PR

%timeit df[:30]
16.2 µs ± 1.23 µs per loop (mean ± std. dev. of 7 runs, 100,000 loops each)  # <- main
11.9 µs ± 184 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each)   # <- PR
```

Labels:
name: Indexing
description: Related to indexing on series/frames, not to indexes themselves
name: Performance
description: Memory or execution speed performance

Comments:
Thanks @jbrockmendel 
Interesting, why is the df faster than the series?
> Interesting, why is the df faster than the series?

```
In [4]: %prun -s cumtime for n in range(10**4): ser[:30]
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    10000    0.038    0.000    0.436    0.000 series.py:971(__getitem__)
    10000    0.019    0.000    0.336    0.000 generic.py:4153(_getitem_slice)
    10000    0.029    0.000    0.269    0.000 series.py:964(_slice)
    10000    0.053    0.000    0.111    0.000 managers.py:1990(get_slice)
    10000    0.049    0.000    0.069    0.000 generic.py:6020(__finalize__)
    10000    0.020    0.000    0.058    0.000 series.py:371(__init__)
    [ommitted stuff that is roughly the same in both]

In [5]: %prun -s cumtime for n in range(10**4): df[:30]
   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
    10000    0.028    0.000    0.386    0.000 frame.py:3736(__getitem__)
    10000    0.018    0.000    0.314    0.000 generic.py:4153(_getitem_slice)
    10000    0.039    0.000    0.252    0.000 generic.py:4172(_slice)
    10000    0.039    0.000    0.078    0.000 {method 'get_slice' of 'pandas._libs.internals.BlockManager' objects}
    10000    0.018    0.000    0.056    0.000 frame.py:651(__init__)
    10000    0.034    0.000    0.050    0.000 generic.py:6020(__finalize__)
    [ommitted stuff that is roughly the same in both]
```

Further investigation welcome.
BUG: to_sql raises when arrow dtype has missing values
State: closed

- [x] closes #52178 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] 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 SQL
description: to_sql, read_sql, read_sql_query
name: Arrow
description: pyarrow functionality

Comments:
Thanks @phofl
BUG: set_levels not preserving categorical
State: closed

- [x] closes #52125 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: MultiIndex
name: Categorical
description: Categorical Data Type

Comments:
Thanks @phofl
BUG: to_numeric converting StringArray to object or float64
State: closed

- [x] closes #52146 (Replace xxxx with the GitHub issue number)
- [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [x] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

don't need a whatsnew if we get it in for 2.0

Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions

Comments:
Thanks @phofl 
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.0.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 e7859983a814b1823cf26e3b491ae2fa3be47c53
```

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

```
git commit -am 'Backport PR #52174: BUG: to_numeric converting StringArray to object or float64'
```

4. Push to a named branch:

```
git push YOURFORK 2.0.x:auto-backport-of-pr-52174-on-2.0.x
```

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

> "Backport PR #52174 on branch 2.0.x (BUG: to_numeric converting StringArray to object or float64)"

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).
DEPR: _metadata propagation
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.

xref #51280

Labels:
name: Mothballed
description: Temporarily-closed PR the author plans to return to

Comments:
Mothballing, will revisit in a few months to see if the pro-_metadata folks make progress on getting it fully working.
> Mothballing, will revisit in a few months to see if the pro-_metadata folks make progress on getting it fully working.

It _is_ working ...
137 xfailed tests in tests.generic.test_finalize say otherwise.
The existence of a many packages implementing subclasses that happily make use of `_metadata` says otherwise?

The tests you are referring to use `attrs` to test this, and not all those tests are relevant for the subclasses using `_metadata`. For example, `describe` is xfailing but I would say this is fine to not propagate attrs/metadata. `squeeze` is xfailing, but that's only because it doesn't actually return a pandas object but a scalar. Some reductions are failing, but I think many subclasses don't care about that use case to preserve the class. Idem for categorical accessors.

So I would say that those xfailed tests are not really an indication of how well this is working in general.
There are better uses of both our time; I have PRs I've been asked to review, and I've asked you to look at topper's reduction PR.
DOC: update examples in MonthBegin/MonthEnd to use rollbackward/rollforward
State: closed

- [ ] closes #52106
updated docstring of pandas.offsets.MonthBegin, pandas.offsets.MonthEnd, pandas.offsets.BMonthBegin, pandas.offsets.BMonthEnd
the output of the `validate_docsctrings.py`  is similar to the below output as follows
```
################################################################################
#################### Docstring (pandas.offsets.MonthBegin)  ####################
################################################################################

DateOffset of one month at beginning.

Examples
--------
>>> ts = pd.Timestamp(2022, 1, 1)
>>> ts + pd.offsets.MonthBegin()
Timestamp('2022-02-01 00:00:00')

################################################################################
################################## Validation ##################################
################################################################################

2 Errors found:
        No extended summary found
        See Also section not found
```

Labels:
name: Docs
name: Frequency
description: DateOffsets

Comments:
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.0.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 4bf60ac2bab5878c1a0f640ab826df77a77f7e98
```

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

```
git commit -am 'Backport PR #52161: Docs/update issue 52106'
```

4. Push to a named branch:

```
git push YOURFORK 2.0.x:auto-backport-of-pr-52161-on-2.0.x
```

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

> "Backport PR #52161 on branch 2.0.x (Docs/update issue 52106)"

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).
                
@pranav-ravuri there's one more related one, in case you wanted to take this one on https://github.com/pandas-dev/pandas/issues/52169
Hi @MarcoGorelli there seems to be conflict, but I did not understand what it is? And how could I have avoided it?
the conflict is only when backporting to version 2.0 (from which the next stable docs will be built) - you did everything right, it's just that not everything gets backported, so conflicts creep in sometimes
DOC Fix EX01 in docstrings - added examples
State: closed

- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Towards https://github.com/pandas-dev/pandas/issues/37875

Labels:
name: Docs

Comments:
I removed: 
```assert Series.hasnans.__doc__ == Index.hasnans.__doc__``` from test.  

The docstrings are not the same with the examples I added - or do I have to make a shared doc?
PERF: Make __iadd__ actually inplace
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.

Starting simple with just ``__iadd__`` for now, eventually want to expand to all arith/logical ops? when I'm feeling braver :).

Everything except:
- SparseArray
- MaskedArray(maybe just needs tests?)
- Some special case with DF+Series (I can't seem to hit this path normally, need to investigate more)

should be implemented. I'll try to get those in a follow up.

Hopefully, I'm not using abusing/breaking existing frame/manager plumbing. I've kinda been hackily inserting return self calls all over.

Labels:
name: Performance
description: Memory or execution speed performance
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations
name: Mothballed
description: Temporarily-closed PR the author plans to return to
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.
Closing to clear the queue, but feel free to reopen when you have time to revisit
Revert "BLD: Add pyproject.toml to wheels"
State: closed

Reverts pandas-dev/pandas#50330
closes #52141 

Was installing pyproject.toml in the wrong place, and there's no way to let configure the install location at least for setuptools.

I guess we'll have to wait for meson builds to try to include pyproject.toml.

Labels:
name: Build
description: Library building on various platforms

Comments:
Thanks @lithomas1
DEPR: attrs
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.

xref #51280

* https://github.com/pandas-dev/pandas/issues/52166

Labels:
name: Needs Discussion
description: Requires discussion from core team before further action
name: Mothballed
description: Temporarily-closed PR the author plans to return to

Comments:
OK thanks for clarifying

let's make a separate issue about this and discuss then, it's controversial enough it may warrant a pdep
Mothballing, will revisit in a few months to see if the pro-attrs folks make progress on getting it fully working.
Fix/mpl37 compat
State: closed

This was reported via https://github.com/matplotlib/matplotlib/issues/25538 , I can not find an issue if @ocefpaf reported one.

- [ ] 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: Visualization
description: plotting

Comments:
> I can not find an issue if @ocefpaf reported one.

I was going to do it today. You were too fast :-)

Thanks @tacaswell!
Thanks @tacaswell 

BTW, we have a branch trying to support Matplotlib 3.7 but we don't really have experienced matplotlib contributors anymore. Any insights would be appreciated: https://github.com/pandas-dev/pandas/pull/51990
@meeseeksdev backport 2.0.x