Repository: pandas-dev/pandas-stubs (language: python)

Issue:
DataFrame.pct_change typing for None missing
**Describe the bug**
A clear and concise description of what the bug is.
For the `pd.DataFrame.pct_change` the documentation allows the `None` method but the typing only supports `str`.
This results in an error from pyright to be raised.


**To Reproduce**
1. Provide a minimal runnable `pandas` example that is not properly checked by the stubs.
2. Indicate which type checker you are using (`mypy` or  `pyright`).
3. Show the error message received from that type checker while checking your example.

```python
df = pd.DataFrame({"x": [1, 2, 2, 3, 3], "y": [10, 20, 30, 40, 50]})
df.pct_change(fill_method=None)
```

This example will yield the error:
```
error: Argument "fill_method" to "pct_change" of "DataFrame" has incompatible type "None"; expected "str"  [arg-type]
```

While the documentation allows for None:
<img width="745" alt="Screenshot 2024-09-03 at 6 04 46 PM" src="https://github.com/user-attachments/assets/c75f9152-f354-4e08-8440-153d55b767a2">


**Please complete the following information:**
 - OS: MacOs
 - OS Version Sonoma 14
 - python version 3.12.4
 - version of type checker 1.1.378
 - version of installed `pandas-stubs` v2.2.2.240807


**Additional context**
Add any other context about the problem here.



Discussion / hints:

Fix patch:
diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi
index 0e151c4a..3102e02f 100644
--- a/pandas-stubs/core/frame.pyi
+++ b/pandas-stubs/core/frame.pyi
@@ -1874,7 +1874,7 @@ class DataFrame(NDFrame, OpsMixin):
     def pct_change(
         self,
         periods: int = ...,
-        fill_method: _str = ...,
+        fill_method: None = ...,
         limit: int | None = ...,
         freq=...,
         **kwargs,


Test patch:
diff --git a/tests/test_frame.py b/tests/test_frame.py
index 33aa1616..2ff0348c 100644
--- a/tests/test_frame.py
+++ b/tests/test_frame.py
@@ -2108,6 +2108,11 @@ def test_groupby_series_methods() -> None:
     gb.nth(0).loc[1]
 
 
+def test_dataframe_pct_change() -> None:
+    df = pd.DataFrame({"x": [1, 2, 2, 3, 3], "y": [10, 20, 30, 40, 50]})
+    df.pct_change(fill_method=None)
+
+
 def test_indexslice_setitem():
     df = pd.DataFrame(
         {"x": [1, 2, 2, 3], "y": [1, 2, 3, 4], "z": [10, 20, 30, 40]}