BrandonFors/pandas-github-issues huggingface dataset:
CI: Fix npdev build post Cython annotation change
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).

Appears the new build failure was due to https://github.com/cython/cython/issues/4885

Major changes:

1. `Period._from_ordinal` is annotated `def _from_ordinal(oridinal: int, freq)` which now strictly only accepts Python ints. Need to change to `def _from_ordinal(oridinal: int64_t, freq)`


Labels:
name: CI
description: Continuous Integration
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
cc @jbrockmendel could use your insight into another failure.

e.g. `np.repeat(EA, 2)` is returning an ndarray instead of an EA. What code path would that go through?
> Period._from_ordinal is annotated def _from_ordinal(oridinal: int, freq), so ordinal needs to always be a Python int and not a np.int64

We end up casting to int64_t, so this casting feels wasteful.  Could we just make the annotation int64_t?
> e.g. np.repeat(EA, 2) is returning an ndarray instead of an EA. What code path would that go through?

np.repeat [uses](https://github.com/numpy/numpy/blob/v1.23.0/numpy/core/fromnumeric.py#L436) array_function_dispatch, which I think means it checks for `__array_function__`, which we don't implement anywhere.  Without `__array_function__`, it isn't that surprising that it returns an ndarray.  If anything I'm surprised it used to (?).

Found it:

We define `def repeat(self, repeats, axis: int = 0)` which `np.repeat` dispatches to

https://github.com/numpy/numpy/blob/54c52f13713f3d21795926ca4dbb27e16fada171/numpy/core/fromnumeric.py#L52-L66=

Since axis can be a `np.int64` it hit's numpy's `except TypeError` block which probably caused the different behavior.

Looks like we need to be careful with annotating cython code with Python types as they will be strict now and raise a `TypeError` otherwise.
> Since axis can be a np.int64 it hit's numpy's except TypeError block which probably caused the different behavior

Sure its int64 and not intp?
> > Since axis can be a np.int64 it hit's numpy's except TypeError block which probably caused the different behavior
> 
> Sure its int64 and not intp?

Hmm good point. `intp` is probably safer here
I decided to remove the `: int` annotation for `repeat(..., axis: int)`. `intp_t` was failing in cython 0.29.x. We can revist the tying in a followup
> Since axis can be a np.int64 it hit's numpy's except TypeError block which probably caused the different behavior.

Thanks @mroeschke for finding this ! I can stop investigating in #46405 :)
Np @smarie, sorry I didn't realized you were investigating it in tandem.

Does it look okay to you @jbrockmendel?  
no objections
Merging to get the CI to green. Can followup if needed
ENH: Add reversed to Series so that it is also a Sequence
State: closed

Add Reversed so that it fulfills all properties of Sequence

- [ ] 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:
WIP to see if these is any appetite to add `__reversed__` to `Series` so that `Series[T]` would also be a `Sequence[T]`, which should help using `Series` throughout the python ecosystem.

xref pandas-dev/pandas-stubs#119
This is an impossible task since a `Sequence` much implement the following methods:

* `__getitem__`
* `__len__ `
* ` __contains__`
* `__iter__`
* `__reversed__`
* `index`  
* `count`

The `index` method cannot be implemented since since `index` returns the `index` and cannot be `index(loc: int)`.  This seems to me to be clearly forever unchangeable.
Enh move pytable errors and warnings
State: closed

- [x] xref #27656. this GitHub issue is being done in multiple parts
- [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).

It looked like `DuplicateWarning` wasn't used anywhere, so I removed it. Also, the if condition for `validate_version` seemed duplicated. Since it inherits from `Fixed`, I replaced it with the already existing property

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

Comments:
Thanks @dataxerik
WEB: Add governance page to the website
State: closed

I was having a look at the [pandas governance repo](https://github.com/pandas-dev/pandas-governance) and seems most things there are duplicated from the website. The list of core developers, the code of conduct, the sponsors, are all in the website, and in my opinion presented in a clearer and more accessible way.

The only thing that is missing is the governance document itself, moving it we can remote that repo. I think it makes more sense to move it here, for few reasons:
- To avoid duplication and inconsistencies, and having to maintain things in two different places
- To have more visibility and easier to access by having it in our public web
- We may want to update the governance document, I think it makes things easier to have the PRs with ammendments to the doc here with the rest of the PRs of the project, instead of in a separate repo

For now I move the `governance.md` file without changes. I think the file can benefit from few changes (updating the title, links...), but I prefer to do it in follow up PRs, so there is visibility of what's being changed.

Somehow related to this PR: @MarcoGorelli, I see in the governance repo we've got Gousto as a pandas sponsor, but it's not in the website (and the logo is not in the home page). Should it be added?


Labels:
name: Admin
description: Administrative tasks related to the pandas project
name: Web
description: pandas website

Comments:
Hey - I'll be leaving Gousto in September to join Quansight, so it should probably be removed
Thanks @datapythonista
ENH: GH19708 - Index now has diff and round methods
State: closed

- [X] closes #19708 
- [ ] [Tests added and passed]
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [X] Added [type annotations]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.

Was unsure how I should add the entry in the whatsnew file, whether in the "Other enhancements" section or if I should create a new separate enhancement entry w/ examples.

Labels:
name: Enhancement
name: Index
description: Related to the Index class or subclasses
name: Stale

Comments:
Hello @brunocoutinhoo! 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-07-10 03:41:21 UTC
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.
ENH - Add index parameter do df.to_dict()
State: closed

- [x] closes #46398
- [x] [Tests added and passed]
- [x] All [code checks passed]
- [x] Added [type annotations]
- [x] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file


Labels:
name: Enhancement
name: Index
description: Related to the Index class or subclasses
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.
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.
SAS7BDAT parser: Improve subheader lookup performance
State: closed

Avoid constructing `_SubheaderPointer` objects and make dictionary lookups in C rather than in Python.

Speedup relative to current `main`:

```
     <main>           <sas/shlookup~1>
-     8.32±0.07ms      7.51±0.06ms     0.90  io.sas.SAS.time_test_meta2_pagesas7bdat
-      82.8±0.5ms       73.6±0.5ms     0.89  io.sas.SAS.time_read_sas7bdat_2_chunked
       before           after         ratio
```

Will extend what's new from https://github.com/pandas-dev/pandas/pull/47404 once that's merged.

- [ ] 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: Performance
description: Memory or execution speed performance
name: IO SAS
description: SAS: read_sas

Comments:
Test failure seems unrelated to this PR but still worth fixing. I'll need some guidance here. The problem is that we don't have an explicit `.close()` when using `pd.read_sas(iterator=True)` and so a file descriptor is leaked. But file handling in `read_sas` is implemented the same way it is implemented in `pd.read_csv(iterator=True)`, which doesn't cause leaked file descriptors. So I wonder what's wrong here.
@mroeschke any pointers for the failing test (see comment above)?
Sorry, I'm not too familiar with this part of the codebase. It looks like it's using the shared file handling code, but not sure if the one of the sas is still keeping a reference to the file handle somewhere?
Bug in `file_leak_context`, see #30096.
@mroeschke tests fixed, should be good to review now.
Thanks @jonashaag
ci: add GitHub token permissions for workflows
State: closed

This PR adds minimum token permissions for the GITHUB_TOKEN using https://github.com/step-security/secure-workflows.

GitHub recommends defining minimum GITHUB_TOKEN permissions for securing GitHub Actions workflows 
- https://github.blog/changelog/2021-04-20-github-actions-control-permissions-for-github_token/  
- https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
- The Open Source Security Foundation (OpenSSF) [Scorecards](https://github.com/ossf/scorecard) treats not setting token permissions as a high-risk issue 

This project is part of the top 100 critical projects as per OpenSSF (https://github.com/ossf/wg-securing-critical-projects), so fixing the token permissions to improve security.

Signed-off-by: Varun Sharma <varunsh@stepsecurity.io>

- [ ] closes #xxxx (Replace xxxx with the Github issue number)
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: CI
description: Continuous Integration

Comments:
If we set `Read repository contents permission` in our repository settings, would we then only need to specify the write permissions when needed?
> If we set `Read repository contents permission` in our repository settings, would we then only need to specify the write permissions when needed?

Hi @mroeschke yes, that is true. At the same time, it is a best practice to set the permissions in the workflow files explicitly. 
- The permissions are encapsulated with the workflow file, so easier to review and version (same reason applies for other `as-code` files)
- If someone forks the repo, the repository settings are not copied over, so the workflow in the forked repo is not secure. Whereas if the workflow file has explicit permissions, the settings are copied over. 

So, setting `Read repository contents permission` in the repo setting is a good idea as future workflows in the repo will be secure-by-default. In addition, I would also recommend setting permissions explicitly in the workflow files. 
Thanks for the explanation. Agreed to make these explicit in the the yaml files then
Thanks @varunsh-coder
Fixed mypy errors in frequencies.py
State: closed

- [ ] xref #37715 (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: Typing
description: type annotations, mypy/pyright type checking

Comments:
Shoot, looks like I accidentally left a change from one of my previous PRs in here, I'll fix that
Thanks @srotondo
ENH: add result_names argument to DataFrame.compare #44354
State: closed

This is following up on the pull request #44365
- [X] closes #44354 (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/v1.5.0.rst` file if fixing a bug or adding a new feature.


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

Comments:
Hello @ahmedibrhm! 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-07-16 04:17:06 UTC
small comments, docs fail
@phofl if any comments
@phofl done, added the test
Thx @ahmedibrhm
TST: adding test for multiindex nunique raising not implemnted error
State: closed

- [x] closes #34019 
- [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).


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

Comments:
Thanks @noatamir
DOC #45443 edited the documentation of where/mask functions
State: closed

- [X] closes #47626 
- [X] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).


Labels:

Comments:
Hello @ahmedibrhm! 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-07-08 07:40:02 UTC
BUG: Series.str.zfill() behaves differently than str.zfill() from standard library
State: closed

- [ ] closes #20868 (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: Strings
description: String extension data type and string data

Comments:
@github-actions pre-commit
Thanks @xr-chen
DOC: fixing override of built-in functions in docs
State: closed

- [x] closes #47606  
- [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).
- [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/user_guide/groupby.rst` file if fixing a bug or adding a new feature.


Labels:

Comments:
Thanks for the pull request, but agreed with @phofl's reasoning and `columns` naming should remain here (we used this naming convention in the code base).

Since the original issue was addressed by https://github.com/pandas-dev/pandas/pull/47631 closing as a duplicate, but happy to have a contribution to any of the other documentation issues
DOC: avoid overriding Python built-in functions
State: closed

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


Labels:
name: Docs

Comments:
Thanks @wany-oh
BUG: using read_xml with iterparse and names will ignore duplicate values
State: closed

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


Labels:
name: Bug
name: IO XML
description: read_xml, to_xml

Comments:
@jreback - Since the `iterparse` is a new, unreleased IO XML feature for 1.5, I was [advised](https://github.com/pandas-dev/pandas/pull/47414#discussion_r902946257) by @mroeschke  on a related fix that a whatsnew note was not needed. The OP of bug was using a dev version of pandas.


got it (could add this PR number alongside the original note as well) but nbd
Thanks @ParfaitG. Yeah if you have a follow up PR in mind, adding an additional ``` :issue:`47630` ``` to the 1.5.0 whatsnew note related to this feature would be good
Test for nested series equality #22400
State: closed

- [ ] closes #22400 (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: Testing
description: pandas testing functions or related to the test suite

Comments:
It seems last time I tried to pr this test, it somehow got stuck onto a different topic and pr by accident, hopefully I've fixed that issue this time around.
Awesome, thanks @srotondo
"DOC #45443 edited the documentation of where/mask functions"
State: closed

- [X] closes #45443
- [X] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).


Labels:
name: Docs

Comments:
Hello @ahmedibrhm! 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-07-08 17:08:48 UTC
Thanks for the responsive updates @ahmedibrhm