BrandonFors/pandas-github-issues huggingface dataset:
Regression in loc.setitem losing mi names when df is empty
State: closed

- [x] closes #46317 (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 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
name: Regression
description: Functionality that used to work in a prior pandas version
name: MultiIndex

Comments:
thanks @phofl 
@meeseeksdev backport 1.4.x
Something went wrong ... Please have a look at my logs.
WIP Add ccache to Azure builds
State: closed

PR #46309 stopped building for some reason??

- [ ] 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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
looks like dupe of #46321 ?
REF: re-share Period methods
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 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: Period
description: Period data type

Comments:
Thanks @jbrockmendel
BUG: avoid OOB flow in read_gbq and to_gbq
State: closed

The console-based copy-paste-a-token flow has been deprecated. See:
https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html?m=1#disallowed-oob

- [ ] 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
- [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/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
thank you @tswast !
DOC: example using `clipboard_set` for all output formats
State: closed

rather than change the underlying `DataFrame.to_clipboard` method, here I just included a simple example to demonstrate how to use pandas to send any output string (in any render format) to the clipboard.

- [x] closes #46269

Labels:
name: Docs

Comments:
I think `clipboard_set` is not even listed as a public function: https://pandas.pydata.org/docs/search.html?q=clipboard_set

Might be good to also add it to the web documentation.
I think `pandas.io.clipboard` is currently not declared as a public module (from a typing perspective). It is not listed here
https://github.com/pandas-dev/pandas/blob/471319ba78c540766368a7a5e784ab20424ba9e1/pandas/io/__init__.py#L12

Would need to add `"clipboard"` to this list. (edit: and import it)
I'm not 100% sure these helpers were ever supposed to be public (since a lot of this code is vendored from pyperclip anyways).

IMO for the original issue, I would just recommend passing the output of `to_html/to_latex/etc` to pyperclip directly.
> I'm not 100% sure these helpers were ever supposed to be public (since a lot of this code is vendored from pyperclip anyways).
> 
> IMO for the original issue, I would just recommend passing the output of `to_html/to_latex/etc` to pyperclip directly.

yes I agree, since pandas just copies the pyperclip module (1.7.0) it is probably worth noting this and stating the user can just import the pyperclip module themselves. 
thanks @attack68
WIP Add ccache to Azure builds 
State: closed

New try of #46307

- [ ] 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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
@phofl do you know why #46308 runs on Azure but not this one?
Not sure, but it might be related to draft status? Also have not looked at your diff
I tried w/o draft, no change. Do you know where on Azure I can go looking for any errors with the pipeline file?
Not really no, https://dev.azure.com/pandas-dev/pandas/_build?view=runs lists all builds, but yours is not there
@phofl seems like at least one GitHub Action must run otherwise Azure won't run. WTF
Ok this is good to know 
nicee
DOC: Add TextFileReader to docs
State: closed

- [x] closes #46187 (Replace xxxx with the Github issue number)
- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

@twoertwein Anything else you would want to add?


Labels:
name: Docs
name: IO CSV
description: read_csv, to_csv

Comments:
If it is a public class, it should also be possible to import it (for example, for typing purposes). Need to declare that `parsers` is public in `io/__init__.py` (`io/parsers/__init_.py` already limits the scope to not make everything in it public).

Need to import io.parsers here and add it to this list: https://github.com/pandas-dev/pandas/blob/471319ba78c540766368a7a5e784ab20424ba9e1/pandas/io/__init__.py#L12
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.
@phofl do you still want to work on this?
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.
Still interested in this @phofl? 
I should :) Would like to keep open for a bit longer
@phofl went ahead and fixed the typo, let's see if CI is green, and I think we can get this merged.
Seems like the doctests still don't pass because of the ellipsis, will have a look later.
@phofl is this still active?
Yeah we should probably fix this
Looks like this has gone stale, feel free to reopen if/when you have time to circle back
WIP Add ccache to Azure builds
State: closed

Based on #45701

- [ ] 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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
Un-drafting to maybe trigger Azure?
Why doesn't this trigger Azure :(
BUG: merge raising for Int64 and int64 dtype with missing values
State: closed

- [x] closes #46178 (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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: NA - MaskedArrays
description: Related to pd.NA and nullable extension arrays
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.
Still working on this @phofl?
CLN/DOC: fix test_register_entrypoint
State: closed

and cleanup tests eg https://github.com/pandas-dev/pandas/issues/27517

- [x] closes #46302 (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 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: Visualization
description: plotting

Comments:
thanks @graingert very nice
BUG: DataFrame.getattribute raising if columns have dtype string
State: closed

- [x] closes #46185 (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 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:
Thanks @phofl
TYP: sort_index
State: closed

Tested the overloads with mypy and pyright:

```py
import pandas as pd

def bool_() -> bool:
    ...

frame = pd.DataFrame()
reveal_type(frame.sort_index()) # DataFrame
reveal_type(frame.sort_index(inplace=True)) # None
reveal_type(frame.sort_index(inplace=False)) # DataFrame
reveal_type(frame.sort_index(inplace=bool_())) # DataFrame | None

series = pd.Series()
reveal_type(series.sort_index()) # Series
reveal_type(series.sort_index(inplace=True)) # None
reveal_type(series.sort_index(inplace=False)) # Series
reveal_type(series.sort_index(inplace=bool_())) # Series | None
```

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

Comments:
can you merge master
green, except for mypy error also present on main
thanks @twoertwein  (and others!)
BUG: PandasArray[uint].factorize
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 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: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
lgtm a hyptothesis failure on arm64: https://app.circleci.com/pipelines/github/pandas-dev/pandas/8935/workflows/1d63a4f5-4f4b-4fa3-9d05-248a23de9e77/jobs/39779 likely unrelated but i suppose is a case
PERF: MultiIndex.values for MI's with DatetimeIndex, TimedeltaIndex, or ExtensionDtype levels
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 an entry in the latest `doc/source/whatsnew/v1.5.0.rst` file if fixing a bug or adding a new feature.


The change is to do the boxing of these types on the distinct level values and then call `.take` rather than calling `.take` and then having to box a potentially much larger array.

The impact is most pronounced when there is a large difference between the number of rows in the index and the number of unique values (e.g. dates) in a given level of the index. 

```
import pandas as pd
import numpy as np

mi = pd.MultiIndex.from_product(
    [ 
        pd.array(np.arange(10000), dtype="Int64"),
        pd.date_range('2000-01-01', periods=1000),
    ]
)

%timeit mi.copy().values

6.63 s ± 212 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)   <- main
775 ms ± 6.99 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)  <- PR
```


Existing asvs:

```
$ asv continuous -f 1.1 upstream/main multiindex-values -b multiindex_object

       before           after         ratio
     <main>           <multiindex-values>
-        32.0±2ms       28.6±0.3ms     0.89  multiindex_object.Duplicated.time_duplicated
-         215±3ms          151±5ms     0.70  multiindex_object.SetOperations.time_operation('non_monotonic', 'datetime', 'intersection')
-       347±0.8ms          226±3ms     0.65  multiindex_object.SetOperations.time_operation('monotonic', 'datetime', 'intersection')
-         323±3ms          208±2ms     0.64  multiindex_object.SetOperations.time_operation('monotonic', 'datetime', 'union')
-         326±5ms          207±5ms     0.64  multiindex_object.SetOperations.time_operation('non_monotonic', 'datetime', 'union')
-         139±1ms         32.4±2ms     0.23  multiindex_object.SetOperations.time_operation('monotonic', 'datetime', 'symmetric_difference')
-         140±2ms       32.3±0.8ms     0.23  multiindex_object.SetOperations.time_operation('non_monotonic', 'datetime', 'symmetric_difference')
-        65.6±3ms       8.79±0.2ms     0.13  multiindex_object.Values.time_datetime_level_values_copy
```

Labels:
name: Performance
description: Memory or execution speed performance
name: MultiIndex

Comments:
thanks @lukemanley keep em coming!
CLN: address xfails
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 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: Clean

Comments:
https://github.com/pandas-dev/pandas/pull/46287/checks?check_run_id=5474679421 ?
remaining fail is geopandas import, seems unrelated
yah same geopandas failure is showing up on other PRs
ENH: Add support for multiple conditions assign statement
State: closed

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


Labels:
name: API - Consistency
description: Internal Consistency of API/Behavior

Comments:
#39154 addresses this
closing, not averse to accepting an additional api for this, but cannot overload this one.
TYP: annotation of __init__ return type (PEP 484) (pandas/io)
State: closed

- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

According to [documentation](https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#type-hints) pandas uses [PEP484](https://www.python.org/dev/peps/pep-0484/) for type hints.
PEP484 states that `__init__` function should have `-> None` return type annotation.
In this PR I added return type annotation to `__init__` functions in `pandas/io` module.
Thanks!


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

Comments:
Hello @nafarya! Thanks for updating this PR. We checked the lines you've touched for [PEP 8](https://www.python.org/dev/peps/pep-0008) issues, and found:

































































There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers: 

##### Comment last updated at 2022-03-09 19:48:54 UTC
Please wait for https://github.com/pandas-dev/pandas/pull/46283#discussion_r823143278
thanks @nafarya 
For some reason, this PR caused mypy to raise this error:

> pandas/io/clipboard/__init__.py:97: error: Module has no attribute "WinError"  [attr-defined]
TYP: annotation of __init__ return type (PEP 484) (pandas/plotting)
State: closed

- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

According to [documentation](https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#type-hints) pandas uses [PEP484](https://www.python.org/dev/peps/pep-0484/) for type hints.
PEP484 states that `__init__` function should have `-> None` return type annotation.
In this PR I added return type annotation to `__init__` functions in `pandas/plotting` module.
Thanks!


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

Comments:
https://dev.azure.com/pandas-dev/pandas/_build/results?buildId=75016&view=logs&j=b1891a80-bdb0-5193-5f59-ce68a0874df0&t=0a58a9e9-0673-539c-5bde-d78a5a3b655e

these might be legit
thanks @nafarya FYI we are going to do these in a few PRs that cover most of the codebase
BUG: MaskedArray._quantile match non-nullable behavior
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 an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

Along with some refactors to 1) de-duplicate squeeze/unsqueeze logic and 2) avoid densifying Sparse

cc @attack68 the edits to the Styler tests are pure guess-and-check to keep the tests passing.  Can you confirm that they make sense?  Maybe suggest a more idiomatic way of expressing the conditions in which to pop?

Labels:
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
name: NA - MaskedArrays
description: Related to pd.NA and nullable extension arrays
name: Stale

Comments:
at first glance it seems that this changes the basic operation.

In the styler tests the dataframe is:

```python
     A    B
0    0    1
1  nan None
2   10    2
```

In the test you have added a highlighted cell in (0,1), and pop it based on other parameters.

Under the base "float64" case when `q_left=0.5` and `q_right=1`, and `axis=0` the `None` value is column B seems to be interpreted as an element (possibly 0) and then {1,2} fall within the quantile, whereas for column A nan is either not interpreted as a value (or 0) and then only {10} falls in the quantile.

On the other hand when axis is `None` only {2, 10} fall within the quantile, suggesting that `nan` and `None` are not evaluated as 0 since otherwise {1} would also be in the quantile.

So, at first glance this seems to give different, non-intuitive values. I will take a closer look later.
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.
@jbrockmendel can you merge master
rebased + green
TYP: annotation of __init__ return type (PEP 484) (misc modules)
State: closed

- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

According to [documentation](https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#type-hints) pandas uses [PEP484](https://www.python.org/dev/peps/pep-0484/) for type hints.
PEP484 states that `__init__` function should have `-> None` return type annotation.
In this PR I added return type annotation to `__init__` functions in the following modules:
`doc`, `pandas/_config`, `pandas/_testing`, `pandas/compat`, `pandas/conftests`, `pandas/errors`, `pandas/tseries`, `scripts`

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

Comments:
thanks @EkaterinaKuzkina
TYP: annotation of __init__ return type (PEP 484) (pandas/core)
State: closed

- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

According to [documentation](https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#type-hints) pandas uses [PEP484](https://www.python.org/dev/peps/pep-0484/) for type hints.
PEP484 states that `__init__ `function should have `-> None` return type annotation.
In this PR I added return type annotation to `__init__` functions in `pandas/core` module.
Thanks!


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

Comments:
lots of failures
> lots of failures

Hi! Updated branch with latest changes from `main` and now it looks fine. (All 3 failures are regarding Azure building and you mention [here](https://github.com/pandas-dev/pandas/pull/46283#issuecomment-1062968031), that these failures might be legit) 
thanks @nafarya
TYP: annotation of __init__ return type (PEP 484) (pandas/tests)
State: closed

- [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).

According to [documentation](https://pandas.pydata.org/docs/dev/development/contributing_codebase.html#type-hints) pandas uses [PEP484](https://www.python.org/dev/peps/pep-0484/) for type hints.
PEP484 states that `__init__` function should have `-> None` return type annotation.
In this PR I added return type annotation to `__init__` functions in `pandas/tests` module


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

Comments:
thanks @EkaterinaKuzkina
BLD: Upload sdist artifact from CI
State: closed

Now it is possible to inspect the sdist that is built, to
see what was included and
for debugging.

Inspired by needing to see what was acutally included in the sdist at
https://github.com/pandas-dev/pandas/pull/46271

- [x] related to #46271 (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] NA Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.

@fangchenli again. Thank you!

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

Comments:
After this PR, you can download the sdist build:

<img width="879" alt="image" src="https://user-images.githubusercontent.com/10820686/157340711-3fbdd96c-2c88-40dc-bdc2-710dee06ff34.png">

The test failures above are unrelated
Thanks @NickCrews