id
int64
number
int64
title
string
state
string
created_at
timestamp[s]
updated_at
timestamp[s]
closed_at
timestamp[s]
html_url
string
is_pull_request
bool
pull_request_url
string
pull_request_html_url
string
user_login
string
comments_count
int64
body
string
labels
list
reactions_plus1
int64
reactions_minus1
int64
reactions_laugh
int64
reactions_hooray
int64
reactions_confused
int64
reactions_heart
int64
reactions_rocket
int64
reactions_eyes
int64
comments
list
2,119,827,045
57,272
PERF: reindex default fill_value dtype
closed
2024-02-06T02:45:31
2024-02-09T21:07:25
2024-02-09T21:06:00
https://github.com/pandas-dev/pandas/pull/57272
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57272
https://github.com/pandas-dev/pandas/pull/57272
mroeschke
1
- [ ] closes #45857 (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.
[ "Missing-data", "Dtype Conversions" ]
0
0
0
0
0
0
0
0
[ "thx @mroeschke " ]
2,119,658,132
57,271
Backport PR #57265 on branch 2.2.x (COMPAT: Numpy 2.0 casting compat)
closed
2024-02-05T23:31:53
2024-02-06T02:28:17
2024-02-06T02:28:17
https://github.com/pandas-dev/pandas/pull/57271
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57271
https://github.com/pandas-dev/pandas/pull/57271
meeseeksmachine
0
Backport PR #57265: COMPAT: Numpy 2.0 casting compat
[ "Compat" ]
0
0
0
0
0
0
0
0
[]
2,119,654,694
57,270
CoW: Remove cow branches from more tests
closed
2024-02-05T23:28:32
2024-02-06T10:15:28
2024-02-06T02:29:12
https://github.com/pandas-dev/pandas/pull/57270
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57270
https://github.com/pandas-dev/pandas/pull/57270
phofl
1
- [ ] 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.
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,119,653,927
57,269
CoW: Finish deprecation enforcal on block level
closed
2024-02-05T23:27:50
2024-02-09T22:07:17
2024-02-09T22:07:10
https://github.com/pandas-dev/pandas/pull/57269
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57269
https://github.com/pandas-dev/pandas/pull/57269
phofl
1
- [ ] 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.
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,119,521,723
57,268
ENH: Preserve input `start`/`end` type in `interval_range`
closed
2024-02-05T21:53:16
2024-02-15T17:35:08
2024-02-15T17:35:07
https://github.com/pandas-dev/pandas/issues/57268
true
null
null
mroeschke
1
```python In [1]: import pandas as pd In [2]: import numpy as np In [3]: pd.interval_range(start=np.int8(1), end=np.int8(10)) Out[3]: IntervalIndex([(1, 2], (2, 3], (3, 4], (4, 5], (5, 6], (6, 7], (7, 8], (8, 9], (9, 10]], dtype='interval[int64, right]') ``` It would be ideal if the resulting dtype was `'interval[int8, right]'`
[ "Enhancement", "Dtype Conversions", "Interval" ]
0
0
0
0
0
0
0
0
[ "In the interval.py, I made it retain the same datatype if both start and end has same datatype\r\n\r\n```python\r\ndtype = start.dtype if start.dtype == end.dtype else np.dtype(\"int64\")\r\nbreaks = maybe_downcast_numeric(\r\n breaks, # type: ignore[arg-type]\r\n dtype,\r\n)\r\nreturn IntervalIndex.from_breaks(breaks, name=name, closed=closed, dtype=IntervalDtype(subtype=dtype, closed=closed))\r\n```\r\nAnd I am getting the desired results\r\n\r\n![image](https://github.com/pandas-dev/pandas/assets/16797137/11331b2e-1702-48ee-987d-93f41868afd4)\r\n" ]
2,119,392,019
57,267
BUG: Series attrs disappear after modifcation to the DataFrame that contains them.
open
2024-02-05T20:21:47
2024-03-08T23:04:48
null
https://github.com/pandas-dev/pandas/issues/57267
true
null
null
lendres
3
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd # Example 1 - changing the data type. df = pd.DataFrame(dict(column1=[1,2,3,4], column2=[1,2,3,4])) df["column1"].attrs['name'] = 'hello' print("\nExample 1 before:") print(df) print("Column1 attributes:", df["column1"].attrs) # Changing the data type of the DataFrame drops the series attributes. df1 = df.astype(float) print("\nAfter type change:") print(df1) print("Column1 attributes:", df1["column1"].attrs) # Example 2 - assignment to a DataFrame. df = pd.DataFrame(dict(column1=[1,2,3,4], column2=[1,2,3,4])) df["column1"].attrs['name'] = 'hello1' df["column2"].attrs['name'] = 'hello2' print("\n\n\nExample 2 before:") print(df) print("Column1 attributes:", df["column1"].attrs) print("Column2 attributes:", df["column2"].attrs) # Assigning a column to the DataFrame drops the attributes from the Series in DataFrame. df["column1"] = df["column1"] + 5 print("\nAfter assignment to DataFrame:") print(df) print("Column1 attributes:", df["column1"].attrs) print("Column2 attributes:", df["column2"].attrs) ``` ### Issue Description # Issue The attrs dictionary of Series are not carried through when operations are performed on a DataFrame. # Example 1 ```python # Example 1 - changing the data type. df = pd.DataFrame(dict(column1=[1,2,3,4], column2=[1,2,3,4])) df["column1"].attrs['name'] = 'hello' print("\nExample 1 before:") print(df) print("Column1 attributes:", df["column1"].attrs) """ OUTUPUT: Example 1 before: column1 column2 0 1 1 1 2 2 2 3 3 3 4 4 Column1 attributes: {'name': 'hello'} """ ``` The first series has an attr stored. However, after changing the data types, the attribute is lost. ```python # Changing the data type of the DataFrame drops the series attributes. df1 = df.astype(float) print("\nAfter type change:") print(df1) print("Column1 attributes:", df1["column1"].attrs) """ OUTUPUT: After type change: column1 column2 0 1.0 1.0 1 2.0 2.0 2 3.0 3.0 3 4.0 4.0 Column1 attributes: {} <-- NO ATTRS """ ``` # Example 2 ```python # Example 2 - assignment to a DataFrame. df = pd.DataFrame(dict(column1=[1,2,3,4], column2=[1,2,3,4])) df["column1"].attrs['name'] = 'hello1' df["column2"].attrs['name'] = 'hello2' print("\n\n\nExample 2 before:") print(df) print("Column1 attributes:", df["column1"].attrs) print("Column2 attributes:", df["column2"].attrs) """ OUTPUT: Example 2 before: column1 column2 0 1 1 1 2 2 2 3 3 3 4 4 Column1 attributes: {'name': 'hello1'} Column2 attributes: {'name': 'hello2'} """ ``` The first series has an attr stored. However, reassigning a column drops the attributes. ```python # Assigning a column to the DataFrame drops the attributes from the Series in DataFrame. df["column1"] = df["column1"] + 5 print("\nAfter assignment to DataFrame:") print(df) print("Column1 attributes:", df["column1"].attrs) print("Column2 attributes:", df["column2"].attrs) """ OUTPUT: After assignment to DataFrame: column1 column2 0 6 1 1 7 2 2 8 3 3 9 4 Column1 attributes: {} <-- NO ATTRS Column2 attributes: {} <-- NO ATTRS """ ``` ### Expected Behavior The attributes (attrs) should be maintained in the DataFrame when operations are performed on it. Tested on 2.1.1 and 2.2.0 ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.11.4.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19044 machine : AMD64 processor : Intel64 Family 6 Model 165 Stepping 2, GenuineIntel byteorder : little LC_ALL : None LANG : en LOCALE : English_United States.1252 pandas : 2.2.0 numpy : 1.26.3 pytz : 2024.1 dateutil : 2.8.2 setuptools : 68.0.0 pip : 23.2.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.3 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.15.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.2 bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.7.1 numba : None numexpr : 2.8.4 odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.1 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "metadata" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report; attr propagation is only partially implemented currently. PRs to fix are welcome!", "take", "On main this type of Series.attr propagation is basically nonexistent. Practically, only DataFrame.attrs are accessible and get attached to the Series when the Series representation of a column is retrieved.\r\n\r\nI would try to implement a solution that introduces hidden column_attrs to the DataFrame that would support this type of Series.attrs propagation. Solutions that only make use of the DataFrame.attrs by design either lack propagation functionality or lead to confusing behaviour." ]
2,119,352,918
57,266
DOC: fix pr02 errors in docstrings - plot.bar, plot.barh, plot.line, plot.pie
closed
2024-02-05T19:55:15
2024-02-07T18:12:40
2024-02-07T18:12:33
https://github.com/pandas-dev/pandas/pull/57266
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57266
https://github.com/pandas-dev/pandas/pull/57266
nkasing
1
Methods for `pandas.Series.plot.bar` and `pandas.DataFrame.plot.bar` have the same underlying usage of `PlotAccessor`. ### validate_docstrings script output 1a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.bar ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.Series.plot.bar" correct. :) ``` 1b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.bar ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.DataFrame.plot.bar" correct. :) ``` 2a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.barh ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.Series.plot.barh" correct. :) ``` 2b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.barh ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.DataFrame.plot.barh" correct. :) ``` 3a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.line ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.Series.plot.line" correct. :) ``` 3b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.line ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.DataFrame.plot.line" correct. :) ``` 4a. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.plot.pie ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.Series.plot.pie" correct. :) 4b. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.plot.pie ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.DataFrame.plot.pie" correct. :) - [x] cross ref #57111 (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.
[ "Docs", "Visualization" ]
0
0
0
0
0
0
0
0
[ "Thanks @noah-asing " ]
2,119,197,960
57,265
COMPAT: Numpy 2.0 casting compat
closed
2024-02-05T18:24:56
2024-02-06T02:26:36
2024-02-05T23:31:27
https://github.com/pandas-dev/pandas/pull/57265
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57265
https://github.com/pandas-dev/pandas/pull/57265
mroeschke
1
null
[ "Compat" ]
0
0
0
0
0
0
0
0
[ "thx" ]
2,119,139,804
57,264
BUG: pandas.tseries.offsets.Second() division
open
2024-02-05T17:56:03
2025-06-02T17:09:47
null
https://github.com/pandas-dev/pandas/issues/57264
true
null
null
famenzel
2
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas.tseries.offsets as tso a = tso.Second()/10 b = tso.Second()*.1 ``` ### Issue Description In contrast to tso.Minute(), tso.Day(), division with tso.Second() with any integer always results in tso.Day(0) (a). This is not the case with the corresponding multiplication (b). In previous pandas versions this did not happen. ### Expected Behavior tso.Second()/10 should return tso.Milli(100) and not tso.Day(0). ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.10.11.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22621 machine : AMD64 processor : Intel64 Family 6 Model 154 Stepping 4, GenuineIntel byteorder : little LC_ALL : None LANG : de_DE.UTF-8 LOCALE : de_DE.cp1252 pandas : 2.2.0 numpy : 1.25.2 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 65.5.0 pip : 23.0.1 Cython : None pytest : 7.4.0 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.14.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.7.3 numba : 0.58.0 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.3 sqlalchemy : 2.0.19 tables : None tabulate : 0.9.0 xarray : None xlrd : None zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None </details>
[ "Bug", "Regression", "Frequency" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Result of a git bisect:\r\n\r\n```\r\ncommit 8b8f0d04795e80a9298688e55bb4164b597392bc\r\nAuthor: jbrockmendel\r\nDate: Tue Dec 19 15:35:22 2023 -0800\r\n\r\n DEPR: Tick.delta (#56558)\r\n```\r\n\r\ncc @jbrockmendel ", "Looks like the difference is with the ``_value`` attr on Timedelta\r\n\r\n```\r\n>>> pd.Timedelta(a)._value\r\n1\r\n>>> a.delta._value\r\n<stdin>:1: FutureWarning: Second.delta is deprecated and will be removed in a future version. Use pd.Timedelta(obj) instead\r\n1000000000\r\n\r\n```\r\n\r\nTaking a look" ]
2,118,959,453
57,263
[pre-commit.ci] pre-commit autoupdate
closed
2024-02-05T16:29:57
2024-02-06T02:46:51
2024-02-06T02:46:48
https://github.com/pandas-dev/pandas/pull/57263
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57263
https://github.com/pandas-dev/pandas/pull/57263
pre-commit-ci[bot]
1
<!--pre-commit.ci start--> updates: - [github.com/astral-sh/ruff-pre-commit: v0.1.6 → v0.2.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.1.6...v0.2.0) - [github.com/pylint-dev/pylint: v3.0.1 → v3.0.3](https://github.com/pylint-dev/pylint/compare/v3.0.1...v3.0.3) - [github.com/PyCQA/isort: 5.12.0 → 5.13.2](https://github.com/PyCQA/isort/compare/5.12.0...5.13.2) <!--pre-commit.ci end-->
[]
0
0
0
0
0
0
0
0
[ "Since https://github.com/pandas-dev/pandas/pull/57182 is bumping ruff and the other updates seem minor, closing in favor of that PR" ]
2,118,015,266
57,262
BUG: Importing `Series` with latest `pytest` and Python 3.12 generates DeprecationWarning
closed
2024-02-05T09:04:29
2024-02-05T15:29:14
2024-02-05T15:29:13
https://github.com/pandas-dev/pandas/issues/57262
true
null
null
adamnsch
2
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example Create a file: ```python from pandas import Series ``` Then on the cmd line run: ```sh python3.12 -m pytest <path-to-file> ``` ### Issue Description Running the command above generates the following output for me: ```sh ======================================= warnings summary ======================================== ../../.pyenv/versions/3.12.0/lib/python3.12/site-packages/dateutil/tz/tz.py:37 XXXXXXX/versions/3.12.0/lib/python3.12/site-packages/dateutil/tz/tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC). EPOCH = datetime.datetime.utcfromtimestamp(0) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ====================================== 1 warning in 0.40s ======================================= ``` ### Expected Behavior No DeprecationWarnining ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.12.0.final.0 python-bits : 64 OS : Darwin OS-release : 23.3.0 Version : Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : None pip : 23.2.1 Cython : None pytest : 7.4.4 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 14.0.2 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Warnings", "Closing Candidate", "Upstream issue" ]
0
0
0
0
0
0
0
1
[ "This looks like an issue with dateutil.\r\n\r\nxref https://github.com/dateutil/dateutil/issues/1314.", "> This looks like an issue with dateutil.\r\n> \r\n> xref [dateutil/dateutil#1314](https://github.com/dateutil/dateutil/issues/1314).\r\n\r\nAh ok 👍 Closing this then" ]
2,117,997,374
57,261
DOC: fix PR02 errors in docstrings of Index subclasses
closed
2024-02-05T08:55:52
2024-02-06T03:27:31
2024-02-05T17:24:55
https://github.com/pandas-dev/pandas/pull/57261
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57261
https://github.com/pandas-dev/pandas/pull/57261
yuanx749
2
To fix PR02 errors, this PR adds `__signature__` to the methods, so that the docs show the correct signature instead of `*args, **kwargs`. - [x] xref #57111(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.
[ "Docs" ]
0
0
0
0
0
1
1
0
[ "Thanks @yuanx749 ", "Awesome!! Thank you " ]
2,117,960,265
57,260
QST: The concept behind how hashes are combined in pandas?
open
2024-02-05T08:35:11
2024-02-05T22:07:00
null
https://github.com/pandas-dev/pandas/issues/57260
true
null
null
phphuc612
2
### Research - [X] I have searched the [[pandas] tag](https://stackoverflow.com/questions/tagged/pandas) on StackOverflow for similar questions. - [X] I have asked my usage related question on [StackOverflow](https://stackoverflow.com). ### Link to question on StackOverflow https://stackoverflow.com/questions/77784124/the-concept-behind-how-hashes-are-combined-in-pandas ### Question about pandas I came across the `combine_hash_arrays` functions in pandas library [here](https://github.com/pandas-dev/pandas/blob/main/pandas/core/util/hashing.py). How does it keep good collision rate after combination ? Does anyone have the mathematical proof for this code ? The below code is retrieved from pandas implementation. ``` def combine_hash_arrays( arrays: Iterator[np.ndarray], num_items: int ) -> npt.NDArray[np.uint64]: """ Parameters ---------- arrays : Iterator[np.ndarray] num_items : int Returns ------- np.ndarray[uint64] Should be the same as CPython's tupleobject.c """ try: first = next(arrays) except StopIteration: return np.array([], dtype=np.uint64) arrays = itertools.chain([first], arrays) mult = np.uint64(1000003) out = np.zeros_like(first) + np.uint64(0x345678) last_i = 0 for i, a in enumerate(arrays): inverse_i = num_items - i out ^= a out *= mult mult += np.uint64(82520 + inverse_i + inverse_i) last_i = i assert last_i + 1 == num_items, "Fed in wrong num_items" out += np.uint64(97531) return out ``` I have already checked whether they work well by checking their combined hashes' collision rate.
[ "Usage Question", "hashing" ]
0
0
0
0
0
0
0
0
[ "#15227 indicates it was taken from https://github.com/python/cpython/blob/main/Objects/tupleobject.c; perhaps researching how CPython does this may be fruitful. I'd recommend searching the Python dev mailing list.", "Here is a more specific link: https://github.com/python/cpython/blob/c32bae52904723d99e1f98e2ef54570268d86467/Objects/tupleobject.c#L291" ]
2,117,910,542
57,259
DOC: `CategoricalDtype` equality semantics aren't completely described
closed
2024-02-05T08:03:57
2024-02-17T12:25:58
2024-02-17T12:25:58
https://github.com/pandas-dev/pandas/issues/57259
true
null
null
VladimirFokow
12
### Pandas version checks - [X] I have checked that the issue still exists on the latest versions of the docs on `main` [here](https://pandas.pydata.org/docs/dev/) ### Location of the documentation https://pandas.pydata.org/docs/user_guide/categorical.html#equality-semantics https://github.com/pandas-dev/pandas/blob/main/pandas/core/dtypes/dtypes.py#L407 ### Documentation problem Problematic [statement 1](https://pandas.pydata.org/docs/user_guide/categorical.html#equality-semantics ): > Two instances of `CategoricalDtype` compare equal whenever they have the same categories and order. Problematic [statement 2](https://github.com/pandas-dev/pandas/blob/main/pandas/core/dtypes/dtypes.py#L407): > 5) A CDT with ordered={False, None} is only equal to another CDT with ordered={False, None} and identical categories. Counter-example: ```py >>> a = pd.Categorical(np.full(2, np.nan, dtype=object)) >>> b = pd.Categorical(np.full(2, np.nan)) >>> a, b ([NaN, NaN] Categories (0, object): [], [NaN, NaN] Categories (0, float64): []) >>> a.dtype, b.dtype (CategoricalDtype(categories=[], ordered=False, categories_dtype=object), CategoricalDtype(categories=[], ordered=False, categories_dtype=float64)) >>> a.dtype == b.dtype False ``` As we can see, they both have `ordered=False`, and their `categories` are same. Following the documentation, they should be equal. ### Suggested fix for documentation to have accurate and exhaustive descriptions
[ "Docs", "Categorical", "good first issue" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report.\r\n\r\n> As we can see, they both have ordered=False, and their categories are same.\r\n\r\nThough both empty, two arrays of different dtypes are not the same.\r\n\r\nI suppose \"including their dtypes\" would be okay to add.", "take", "thanks @rhshadrach !\r\nI don't think this is a good first issue, because someone with an accurate and full conceptual understanding of `Categorical` and `CategoricalDtype` should help edit these descriptions.\r\nI expand on this in [PR #57273](https://github.com/pandas-dev/pandas/pull/57273#issuecomment-1929049214)\r\n(but on the other hand, maybe it is good - for people to figure this out and then write their findings)", "![Capture2](https://github.com/pandas-dev/pandas/assets/140050845/9e0bf589-52bc-4c78-a7eb-2b43b14d4e9f)\r\n#57259", "@Mehnaz02 \r\ndtype in `b` in my example is `float64`\r\n(the whole point is `a` and `b` having different `dtype`s in their `CategoricalDtype`s):\r\n```py\r\n# when\r\na.categories.dtype\r\n# is different from:\r\nb.categories.dtype\r\n```\r\n\r\n(btw, in the latest pandas version `a.dtype` also prints the `categories_dtype` at the end)", "I can try starting to fix it, but definitely much later.. \r\nand would need a technical check for accuracy.", "> I don't think this is a good first issue, because someone with an accurate and full conceptual understanding of `Categorical` and `CategoricalDtype` should help edit these descriptions.\r\n\r\nI disagree with this assessment. I believe one just needs to modify the documentation to state that the categories must be the equal as indexes, and that in particular includes their dtype. Am I missing something?\r\n\r\nIn addition, all PRs are reviewed, and so help can be given as part of that review.", "> all PRs are reviewed, and so help can be given as part of that review.\r\n\r\nAs a regular contributor with little experience in the pandas community, I've observed that the label 'good first issue' extends beyond mere simplicity in solving a problem. Typically, it's assigned to documentation-related tasks, serving as a helpful starting point for newcomers eager to engage with the community. \r\n\r\nHowever, this doesn't diminish the significance of documentation enhancements in the community's eyes. Every pull request, regardless of its nature, undergoes review and suggestions. Nevertheless, complex documentation improvements might demand more effort from reviewers, particularly as they often originate from contributors unfamiliar with the pandas community.\r\n\r\n> I believe one just needs to modify the documentation to state that the categories must be the equal as indexes, and that in particular includes their dtype.\r\n\r\nIn issues #57273 and #57281, I believe @VladimirFokow intended to convey that not only this specific aspect of the documentation, but the documentation as a whole, seems somewhat perplexing to him.", "thank you so much @luke396 !!\r\nOkay, help on the review sounds good👍", "Hey, I hope you're doing well team.\r\nLooking for an interesting issue to contribute, any reco please?\r\n", "Hello @eaedk !\r\nHow about this one?", "Hello @VladimirFokow, oh I thought it was solved. \r\nI would like to, of course I will ask questions for guidance." ]
2,117,835,719
57,258
BUG: CategoricalDtype.__init__() got an unexpected keyword argument 'categories_dtype'
closed
2024-02-05T07:12:58
2024-02-05T10:10:05
2024-02-05T10:10:05
https://github.com/pandas-dev/pandas/issues/57258
true
null
null
VladimirFokow
1
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python from pandas.api.types import CategoricalDtype CategoricalDtype(categories=['a', 'b', 'c'], ordered=False, categories_dtype=object) ``` ### Issue Description [Example from the docs](https://pandas.pydata.org/docs/user_guide/categorical.html#categoricaldtype) produces an error: ``` TypeError: CategoricalDtype.__init__() got an unexpected keyword argument 'categories_dtype' ``` there is no `categories_dtype` argument 🫤: https://github.com/pandas-dev/pandas/blob/main/pandas/core/dtypes/dtypes.py#L218 ### Expected Behavior doc examples should work ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.6.final.0 python-bits : 64 OS : Darwin OS-release : 23.2.0 Version : Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.3.2 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : 8.21.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "my bad, this code is the output, not the input" ]
2,117,537,179
57,257
error_bad_lines not work, but how do I read data successfully?
closed
2024-02-05T02:29:38
2024-05-19T18:36:05
2024-05-19T18:36:04
https://github.com/pandas-dev/pandas/issues/57257
true
null
null
zysNLP
4
Since I use panda as version=2.2 I found "error_bad_lines" para was dropped, but I use pd.read_csv("unknown.csv"), Got an Error: Traceback (most recent call last): File "D:\work\email_reply\data_process.py", line 11, in <module> df = pd.read_csv('./data/data_0101.csv', on_bad_lines="warn") File "D:\miniconda3\envs\py310\lib\site-packages\pandas\io\parsers\readers.py", line 1024, in read_csv return _read(filepath_or_buffer, kwds) File "D:\miniconda3\envs\py310\lib\site-packages\pandas\io\parsers\readers.py", line 624, in _read return parser.read(nrows) File "D:\miniconda3\envs\py310\lib\site-packages\pandas\io\parsers\readers.py", line 1921, in read ) = self._engine.read( # type: ignore[attr-defined] File "D:\miniconda3\envs\py310\lib\site-packages\pandas\io\parsers\c_parser_wrapper.py", line 234, in read chunks = self._reader.read_low_memory(nrows) File "parsers.pyx", line 838, in pandas._libs.parsers.TextReader.read_low_memory File "parsers.pyx", line 905, in pandas._libs.parsers.TextReader._read_rows File "parsers.pyx", line 874, in pandas._libs.parsers.TextReader._tokenize_rows File "parsers.pyx", line 891, in pandas._libs.parsers.TextReader._check_tokenize_status File "parsers.pyx", line 2061, in pandas._libs.parsers.raise_parser_error pandas.errors.ParserError: Error tokenizing data. C error: Buffer overflow caught - possible malformed input file. So how could I read this data sucessfully now ? If there is a better way to deal with this?
[ "Usage Question", "IO CSV", "Needs Info", "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "You can look into the ``on_bad_lines`` parameter.", "I'm seeing the identical error [nearly to the same line numbers] on pip 2.2.0. I tried updating to 2.2.1 before reading this (obviously didn't help). Has anyone found a solution??", "Can you provide a reproducible example?", "Closing as a usage question and no reproducible example to act on" ]
2,117,400,649
57,256
TYP: misc Index return types
closed
2024-02-05T00:07:29
2024-02-10T20:34:29
2024-02-05T23:14:29
https://github.com/pandas-dev/pandas/pull/57256
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57256
https://github.com/pandas-dev/pandas/pull/57256
twoertwein
2
null
[ "Typing" ]
0
0
0
0
0
0
0
0
[ "> Looks good just a linting failure\r\n\r\nThanks, I didn't notice that! I put IndexT on the ignore list for codespell.", "Thanks @twoertwein " ]
2,117,394,916
57,255
CoW: Remove copy-on-write conditions from frame tests
closed
2024-02-04T23:56:23
2024-02-05T09:06:40
2024-02-05T02:01:35
https://github.com/pandas-dev/pandas/pull/57255
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57255
https://github.com/pandas-dev/pandas/pull/57255
phofl
1
Getting started here as well
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,117,388,529
57,254
CoW: Enforce some deprecations on the datafame level
closed
2024-02-04T23:44:11
2024-02-09T22:01:37
2024-02-09T22:01:01
https://github.com/pandas-dev/pandas/pull/57254
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57254
https://github.com/pandas-dev/pandas/pull/57254
phofl
2
- [ ] 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. Got most usages on the frame/series level
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "this should take care of the failures", "Thanks @phofl " ]
2,117,374,328
57,253
CoW: Enforce some deprecations on the block level
closed
2024-02-04T23:25:18
2024-02-05T09:06:33
2024-02-05T02:00:07
https://github.com/pandas-dev/pandas/pull/57253
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57253
https://github.com/pandas-dev/pandas/pull/57253
phofl
1
This starts ripping the branches out of blocks.py, remaining ones will follow in another pr
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,117,302,922
57,252
PERF: RangeIndex.append with the same index
closed
2024-02-04T21:02:50
2024-02-09T21:31:13
2024-02-09T21:07:41
https://github.com/pandas-dev/pandas/pull/57252
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57252
https://github.com/pandas-dev/pandas/pull/57252
mroeschke
1
```python In [1]: import pandas as pd, numpy as np In [2]: idx = pd.RangeIndex(1000) In [3]: %timeit idx.append([idx] * 100_000) 362 ms ± 4.39 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # main 342 ms ± 4.07 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # pr ```
[ "Performance", "Index" ]
0
0
0
0
0
0
0
0
[ "thx @mroeschke " ]
2,117,134,898
57,251
DOC: DeprecationWarning:
closed
2024-02-04T14:45:33
2024-02-04T14:48:48
2024-02-04T14:48:20
https://github.com/pandas-dev/pandas/issues/57251
true
null
null
goldenage75
1
### Pandas version checks - [X] I have checked that the issue still exists on the latest versions of the docs on `main` [here](https://pandas.pydata.org/docs/dev/) ### Location of the documentation C:\Users\Lord\AppData\Local\Temp\ipykernel_10296\2035458946.py:1: DeprecationWarning ### Documentation problem C:\Users\Lord\AppData\Local\Temp\ipykernel_10296\2035458946.py:1: DeprecationWarning: Pyarrow will become a required dependency of pandas in the next major release of pandas (pandas 3.0), (to allow more performant data types, such as the Arrow string type, and better interoperability with other libraries) but was not found to be installed on your system. If this would cause problems for you ### Suggested fix for documentation DeprecationWarning:
[ "Duplicate Report" ]
0
0
0
0
0
0
0
0
[ "Thanks @goldenage75 for the report. Please report in #54466. closing as duplicate" ]
2,117,112,223
57,250
REGR/DOC: pd.concat should special case DatetimeIndex to sort even when sort=False
closed
2024-02-04T14:06:07
2024-02-10T09:51:19
2024-02-09T22:07:01
https://github.com/pandas-dev/pandas/pull/57250
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57250
https://github.com/pandas-dev/pandas/pull/57250
lukemanley
3
- [x] closes #57006 - [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/v2.2.1.rst` file if fixing a bug or adding a new feature. Reverts the changes from #54769 due to long-standing behavior and documents the behavior instead. See discussion regarding the inconsistency of the long-standing behavior here: https://github.com/pandas-dev/pandas/issues/57006#issuecomment-1913562404
[ "Docs", "Reshaping", "Regression" ]
0
0
0
0
0
0
0
0
[ "thx @lukemanley ", "IMO I think this case should still be deprecated. Carve-outs like this ultimately lead to confusion", "> IMO I think this case should still be deprecated. Carve-outs like this ultimately lead to confusion\r\n\r\nI opened https://github.com/pandas-dev/pandas/issues/57335 for discussion." ]
2,117,105,605
57,249
Update type hint in io/formats/format.py
closed
2024-02-04T13:49:24
2024-02-04T16:07:31
2024-02-04T16:05:20
https://github.com/pandas-dev/pandas/pull/57249
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57249
https://github.com/pandas-dev/pandas/pull/57249
MarkBekooy
2
The brackets around the type hint broke the libcst parser. Since the brackets are not necessary for the type hint, they have been removed - [x] closes #57248 - [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.
[ "Typing" ]
0
0
0
0
0
0
0
0
[ "@twoertwein i've milestoned 3.0 since we normally don't backport typing changes and the problem code has not been modified recently but if the superfluous parenthesis breaks things feel feel to change to 2.2.1 as it would probably do no harm.", "Thank you @FrostMegaByte!\r\n\r\nI'm with you, @simonjayhawkins, on not backporting (it doesn't impact major typecheckers and seems more like a libcst issue), but I have no strong opinion." ]
2,117,103,075
57,248
BUG: breaking type annotation of `format_percentiles` function in `io/formats/format.py`
closed
2024-02-04T13:42:42
2024-02-04T16:05:21
2024-02-04T16:05:21
https://github.com/pandas-dev/pandas/issues/57248
true
null
null
MarkBekooy
1
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python Open `io/formats/format.py` file and see that the following: def format_percentiles( percentiles: (np.ndarray | Sequence[float]), ) -> list[str]: ``` ### Issue Description The brackets of `(np.ndarray | Sequence[float])` should be removed as they break the libcst parser and they are unneccesary ### Expected Behavior Removed brackets ### Installed Versions <details> ... </details>
[ "Bug", "good first issue", "Typing" ]
1
0
0
0
0
0
0
0
[ "Since it's valid Python, it sounds like this should also be reported to libcst." ]
2,117,080,252
57,247
Fix errors in docstring for `pandas.PeriodIndex`
closed
2024-02-04T12:43:50
2024-02-05T04:04:48
2024-02-04T18:19:04
https://github.com/pandas-dev/pandas/pull/57247
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57247
https://github.com/pandas-dev/pandas/pull/57247
yuanx749
1
Fix errors in `pandas.PeriodIndex`. While working on it, I also add docstrings to the two associated new methods. - [x] xref #57111(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.
[ "Docs", "Period" ]
0
0
0
0
0
0
0
0
[ "Thanks @yuanx749 " ]
2,117,042,290
57,246
DEPR: Remove first and last from DataFrame
closed
2024-02-04T11:16:04
2024-02-04T15:20:56
2024-02-04T15:17:30
https://github.com/pandas-dev/pandas/pull/57246
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57246
https://github.com/pandas-dev/pandas/pull/57246
phofl
3
- [ ] 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. xref #53710
[ "Deprecate", "DataFrame" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl ", "@rhshadrach you can’t add the deprecation label, otherwise the bot will pick it up \r\n\r\nwe would have to add a new label if we want to group the enforcals somehow", "Ah - thanks" ]
2,116,944,893
57,245
DOC: Pandas Case_When
closed
2024-02-04T08:11:55
2024-05-31T22:13:05
2024-05-31T22:13:04
https://github.com/pandas-dev/pandas/issues/57245
true
null
null
MesumRaza
3
### Pandas version checks - [X] I have checked that the issue still exists on the latest versions of the docs on `main` [here](https://pandas.pydata.org/docs/dev/) ### Location of the documentation https://pandas.pydata.org/docs/dev/reference/api/pandas.Series.case_when.html ### Documentation problem The example provide is not intuitive. ### Suggested fix for documentation I found the example of pd.Series.case_when very non intuitive hence here is the updated example Examples -------- >>> # Real-world example: Updating product prices based on a dynamic pricing strategy >>> current_prices = pd.Series([50, 75, 100, 120], name='current_prices') >>> demand_forecast = pd.Series([100, 80, 50, 120], name='demand_forecast') >>> # Conditions for price adjustments based on demand forecast >>> conditions = [ ... (demand_forecast > 90, current_prices * 1.2), # Increase by 20% for high demand ... (demand_forecast < 60, current_prices * 0.8), # Decrease by 20% for low demand ... (current_prices > 100, current_prices * 0.95) # Apply a 5% discount for high-priced items ... ] >>> # Applying the dynamic pricing strategy >>> updated_prices = current_prices.case_when(caselist=conditions) >>> updated_prices 0 60.0 1 75.0 2 80.0 3 114.0 Name: current_prices, dtype: float64
[ "Docs", "Needs Info", "Conditionals" ]
0
0
0
0
0
0
0
0
[ "Thanks for the suggestion.\r\n\r\n> The example provide is not intuitive.\r\n\r\nCan you expand on this?", "I think the minimal example in the docs is good - because it is the simplest case, intended to demonstrate the mechanics as clearly as possible.\r\n\r\nThat said, for me another example - with the application of this method - would be also good to have. But perhaps even better to have - would be a reference to [`np.select`](https://numpy.org/doc/stable/reference/generated/numpy.select.html#numpy-select) - because I didn't get it at first, but essentially it's like `np.select`, right? - just for a Series (and in-place ?). Can there be a reference to `np.select` in \"See also\", or is linking to methods outside of pandas prohibited?\r\n\r\nSome additional thoughts on improving that page:\r\n\r\n- good: It gives an example where both `a` and `b` compete for the `.gt(0)`, but bad: the order of dominance isn't described explicitly with words (as I understood, the higher replacement (closer to the start of the list) dominates in case of collisions). But since this isn't stated clearly, maybe there is some other logic of dominance..\r\n\r\n- purpose of `, name='c'` isn't clear.. Is this required? If not, why not remove it to have less confusion\r\n\r\n- returns this series edited in place, or a new series?", "Seems like the example is OK so closing" ]
2,116,942,815
57,244
QST: How to become a Collaborator?
closed
2024-02-04T08:10:32
2024-02-04T11:09:07
2024-02-04T11:09:07
https://github.com/pandas-dev/pandas/issues/57244
true
null
null
MesumRaza
1
### Research - [X] I have searched the [[pandas] tag](https://stackoverflow.com/questions/tagged/pandas) on StackOverflow for similar questions. - [X] I have asked my usage related question on [StackOverflow](https://stackoverflow.com). ### Link to question on StackOverflow https:// ### Question about pandas I want to contribute to documentation and docstrings for Real world examples
[ "Usage Question", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "See https://pandas.pydata.org/docs/development/contributing.html" ]
2,116,931,843
57,243
DOC: fix PR02 errors in docstring for pandas.core.groupby.DataFrameGroupBy.corrwith
closed
2024-02-04T07:51:27
2024-02-07T01:31:22
2024-02-06T17:38:57
https://github.com/pandas-dev/pandas/pull/57243
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57243
https://github.com/pandas-dev/pandas/pull/57243
jordan-d-murphy
2
All PR02 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.DataFrameGroupBy.corrwith 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.corrwith OUTPUT: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.DataFrameGroupBy.corrwith ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.core.groupby.DataFrameGroupBy.corrwith" correct. :) ``` 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.corrwith ``` ################################################################################ ################################## Validation ################################## ################################################################################ Docstring for "pandas.DataFrame.corrwith" correct. :) ``` - [x] xref https://github.com/pandas-dev/pandas/issues/57111 - [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.
[ "Docs", "Groupby" ]
0
0
0
0
0
0
0
0
[ "@mroeschke can you take a look at this PR when you get a chance? ", "Thanks keep em coming!" ]
2,116,884,401
57,242
DOC: Fix typo in merging.rst
closed
2024-02-04T04:55:59
2024-02-04T05:21:19
2024-02-04T05:21:06
https://github.com/pandas-dev/pandas/pull/57242
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57242
https://github.com/pandas-dev/pandas/pull/57242
thadguidry
1
- [ ] 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.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks @thadguidry " ]
2,116,847,445
57,241
DEPR: Remove sql.execute, *args/**kwargs in resample, unrecognized timezones
closed
2024-02-04T03:07:01
2024-02-06T18:44:29
2024-02-06T18:20:07
https://github.com/pandas-dev/pandas/pull/57241
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57241
https://github.com/pandas-dev/pandas/pull/57241
mroeschke
1
null
[ "Clean" ]
0
0
0
0
0
0
0
0
[ "Thanks @mroeschke " ]
2,116,793,240
57,240
Backport PR #57232 on branch 2.2.x (REGR: to_json converting nullable ints to floats)
closed
2024-02-04T01:20:35
2024-02-04T03:08:15
2024-02-04T03:08:15
https://github.com/pandas-dev/pandas/pull/57240
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57240
https://github.com/pandas-dev/pandas/pull/57240
meeseeksmachine
0
Backport PR #57232: REGR: to_json converting nullable ints to floats
[ "Regression", "IO JSON" ]
0
0
0
0
0
0
0
0
[]
2,116,792,327
57,239
DOC: fix PR02 errors in docstring for pandas.Series.rename_axis
closed
2024-02-04T01:19:50
2024-02-04T18:21:34
2024-02-04T18:21:23
https://github.com/pandas-dev/pandas/pull/57239
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57239
https://github.com/pandas-dev/pandas/pull/57239
jordan-d-murphy
2
All PR02 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.rename_axis 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.rename_axis OUTPUT: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.Series.rename_axis ``` ################################################################################ ################################## Validation ################################## ################################################################################ 1 Errors found for `pandas.Series.rename_axis`: ES01 No extended summary found ``` 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.DataFrame.rename_axis ``` ################################################################################ ################################## Validation ################################## ################################################################################ 1 Errors found for `pandas.DataFrame.rename_axis`: ES01 No extended summary found ``` - [x] xref https://github.com/pandas-dev/pandas/issues/57111 - [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.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "@mroeschke I've pushed a fix for your suggested improvements, can you take another look?", "Thanks @jordan-d-murphy " ]
2,116,754,130
57,238
Remove Copy-on-Write builds
closed
2024-02-04T00:14:33
2024-02-04T01:17:56
2024-02-04T01:17:41
https://github.com/pandas-dev/pandas/pull/57238
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57238
https://github.com/pandas-dev/pandas/pull/57238
phofl
1
- [ ] 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.
[ "CI", "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,116,744,899
57,237
Remove Copy-on-Write warning mode from tests
closed
2024-02-04T00:05:54
2024-02-16T15:20:41
2024-02-04T01:14:14
https://github.com/pandas-dev/pandas/pull/57237
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57237
https://github.com/pandas-dev/pandas/pull/57237
phofl
1
- [ ] 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.
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,116,744,441
57,236
DOC: Clarifying brackets vs. parentheses
closed
2024-02-04T00:05:26
2024-02-04T18:25:47
2024-02-04T15:24:14
https://github.com/pandas-dev/pandas/pull/57236
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57236
https://github.com/pandas-dev/pandas/pull/57236
nkasing
1
- [x] closes #56972 - [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). (Doc edits only) - [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions. (Doc edits only) - [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature. (Doc edits only) In addition to the clarification requested in #56972, I adjusted the language where square brackets were specified elsewhere in the documentation to match "square brackets ``[]``", with the exception of one file. In the data subsetting tutorial guide (`doc/source/getting_started/intro_tutorials/03_subset_data.rst`), square brackets are specified towards the beginning of the guide, and "selection brackets" was used elsewhere, often to specify outer vs. inner square brackets (i.e. `df[['ColA', 'ColB']]`)
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks @noah-asing!" ]
2,116,717,762
57,235
DOC: Updated docstring for set_option
closed
2024-02-03T23:42:37
2024-02-05T21:53:52
2024-02-05T17:29:52
https://github.com/pandas-dev/pandas/pull/57235
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57235
https://github.com/pandas-dev/pandas/pull/57235
jrmylow
3
- [X] closes #57148 - [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).
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Also related: https://github.com/pandas-dev/pandas/issues/57111", "pre-commit.ci autofix", "Thanks @jrmylow " ]
2,116,716,353
57,234
Remove Copy-on-Write warning mode
closed
2024-02-03T23:36:58
2024-02-04T01:11:49
2024-02-04T01:11:11
https://github.com/pandas-dev/pandas/pull/57234
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57234
https://github.com/pandas-dev/pandas/pull/57234
phofl
1
This removes the warning mode from the code, tests will follow in a separate PR cc @mroeschke
[ "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,116,710,632
57,233
REGR: Fix to_numpy conversion for arrow ea with float dtype given
closed
2024-02-03T23:12:42
2024-02-07T18:22:31
2024-02-07T16:52:08
https://github.com/pandas-dev/pandas/pull/57233
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57233
https://github.com/pandas-dev/pandas/pull/57233
phofl
3
- [ ] 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. xref #57121
[ "Arrow" ]
0
0
0
0
0
0
0
0
[ "This should fix #57093 as well. \r\n\r\nI started something similar in #57170. Do you want to copy the test from #57170 into this PR and I'll close mine?\r\n\r\nyou might also want to include the `NaT` cases I have in #57170 as it will fix this which currently raises:\r\n\r\n```\r\nimport pandas as pd\r\n\r\nser = pd.Series([1, None], dtype='Int64')\r\nser.astype(\"m8[ns]\")\r\n```", "Does this address https://github.com/pandas-dev/pandas/pull/57233#issuecomment-1925737224 as well?", "Yikes I missed that comment, will follow up" ]
2,116,707,301
57,232
REGR: to_json converting nullable ints to floats
closed
2024-02-03T22:59:47
2024-02-04T01:34:23
2024-02-04T01:20:05
https://github.com/pandas-dev/pandas/pull/57232
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57232
https://github.com/pandas-dev/pandas/pull/57232
phofl
1
- [ ] closes #57224 (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.
[ "Regression", "IO JSON" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,116,701,137
57,231
DEPR: Remove Index type checking attributes
closed
2024-02-03T22:35:19
2024-02-09T17:34:02
2024-02-08T22:09:38
https://github.com/pandas-dev/pandas/pull/57231
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57231
https://github.com/pandas-dev/pandas/pull/57231
mroeschke
1
- [ ] 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.
[ "Index" ]
0
0
0
0
0
0
0
0
[ "Going to merge this one in. Happy to follow up." ]
2,116,686,374
57,230
DOC: fix PR02 errors in docstring for pandas.io.formats.style.Styler.to_excel
closed
2024-02-03T21:37:36
2024-02-04T01:20:36
2024-02-04T01:07:01
https://github.com/pandas-dev/pandas/pull/57230
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57230
https://github.com/pandas-dev/pandas/pull/57230
jordan-d-murphy
1
All PR02 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.io.formats.style.Styler.to_excel OUTPUT: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.io.formats.style.Styler.to_excel ``` ################################################################################ ################################## Validation ################################## ################################################################################ 1 Errors found for `pandas.io.formats.style.Styler.to_excel`: PR01 Parameters {'verbose', 'encoding'} not documented ``` - [x] xref https://github.com/pandas-dev/pandas/issues/57111 - [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.
[ "Docs", "IO Excel" ]
0
0
0
0
0
0
0
0
[ "Thanks @jordan-d-murphy " ]
2,116,685,958
57,229
BUG: A Warning is emitted in Pandas 2.2.0 when I change the type of a column using `df.iloc[:, i]=...`
closed
2024-02-03T21:35:59
2025-05-20T07:47:38
2024-02-03T22:49:01
https://github.com/pandas-dev/pandas/issues/57229
true
null
null
mwouts
3
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd df = pd.DataFrame({'a': [1]}) # Change the type of colum 0. # NB I Use column indices as sometimes # df has duplicated column names i = 0 x = df.iloc[:, i] df.iloc[:,i] = x.astype(str) ``` ### Issue Description When I replace an integer column by its string representation, the following warning is emitted (see https://github.com/mwouts/itables/issues/223): ``` FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '0 1 Name: a, dtype: object' has dtype incompatible with int64, please explicitly cast to a compatible dtype first. df.iloc[:,i] = x.astype(str) ``` ### Expected Behavior I think the warning makes sense when I replace only a fraction of the rows, but here I replace the full column, so I am not sure the warning is legit. Do you think we could drop the warning when the full column is replaced, or is there a better way to replace the i-th column? Thanks! ### Installed Versions <details> <summary><code>pd.show_versions()</code></summary> <code> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.7.final.0 python-bits : 64 OS : Linux OS-release : 6.5.0-14-generic Version : #14~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Nov 20 18:15:30 UTC 2 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_GB.UTF-8 LOCALE : en_GB.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.3.1 Cython : None pytest : 7.4.0 hypothesis : None sphinx : 7.2.6 blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.20.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.2 bottleneck : 1.3.7 dataframe-api-compat : None fastparquet : None fsspec : 2023.12.2 gcsfs : 2023.12.2post1 matplotlib : 3.8.2 numba : None numexpr : 2.8.7 odfpy : None openpyxl : None pandas_gbq : None pyarrow : 11.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : 2.0.25 tables : None tabulate : 0.9.0 xarray : None xlrd : None zstandard : None tzdata : 2023.3 qtpy : 2.4.1 pyqt5 : None </code> </details>
[ "Bug", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "You should use isetitem if you don't want to modify your object inplace and thus avoid the warning\r\n\r\n```\r\ndf.isetitem(i, df.iloc[:,i].astype(str))\r\n```", "Sounds great! Thank you for pointing out at isetitem!", "`df.loc[:, \"COL\"] = df[\"COL\"].astype(str) ` issues `FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas.` too. I've been struggling for hours :(" ]
2,116,645,064
57,228
TYP: misc IO return types
closed
2024-02-03T19:09:18
2024-02-10T20:34:31
2024-02-03T21:24:50
https://github.com/pandas-dev/pandas/pull/57228
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57228
https://github.com/pandas-dev/pandas/pull/57228
twoertwein
1
mostly for the CSV methods
[ "Typing" ]
0
0
0
0
0
0
0
0
[ "Thanks @twoertwein " ]
2,116,631,918
57,227
Update style.ipynb http -> https
closed
2024-02-03T18:25:44
2024-02-03T21:38:54
2024-02-03T20:01:01
https://github.com/pandas-dev/pandas/pull/57227
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57227
https://github.com/pandas-dev/pandas/pull/57227
partev
1
http://seaborn.pydata.org/ -> https://seaborn.pydata.org/ - [ ] 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.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks @partev " ]
2,116,622,677
57,226
WEB: Using Bootstrap icon instead of font awesome icons
closed
2024-02-03T18:11:13
2024-02-05T17:33:00
2024-02-05T17:32:53
https://github.com/pandas-dev/pandas/pull/57226
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57226
https://github.com/pandas-dev/pandas/pull/57226
koushik-rout-samsung
3
Closes https://github.com/pandas-dev/pandas/issues/57165
[ "Web" ]
0
0
0
0
0
0
0
0
[ "/preview", "Website preview of this PR available at: https://pandas.pydata.org/preview/pandas-dev/pandas/57226/", "Thanks @koushik-rout-samsung " ]
2,116,520,702
57,225
BUG: Raise if an aggregation function other than mean is used with ewm and times
closed
2024-02-03T14:57:55
2024-02-03T21:55:04
2024-02-03T21:54:36
https://github.com/pandas-dev/pandas/pull/57225
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57225
https://github.com/pandas-dev/pandas/pull/57225
stevenschaerer
1
Ran into this recently and found an issue was reported a while ago without any progress (#51695) - [x] closes #51695 - [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.
[ "Window" ]
0
0
0
0
0
0
0
0
[ "Thanks @stevenschaerer " ]
2,116,463,645
57,224
BUG: `DataFrame#to_json` in pandas 2.2.0 outputs `Int64` values containing `NA` as floats
closed
2024-02-03T12:29:50
2024-02-04T10:01:59
2024-02-04T01:20:06
https://github.com/pandas-dev/pandas/issues/57224
true
null
null
skatsuta
0
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd df = pd.DataFrame({"a": [1, pd.NA]}, dtype="Int64") json = df.to_json(orient="records", lines=True) print(json) # Output: # {"a":1.0} <- float! # {"a":null} ``` ### Issue Description In pandas 2.1.4, `DataFrame#to_json` outputs `Int64` integers as JSON integers even if the column contains `NA`, as shown below. This is an expected behavior. ```python # pandas 2.1.4 import pandas as pd df = pd.DataFrame({"a": [1, pd.NA]}, dtype="Int64") json = df.to_json(orient="records", lines=True) print(json) # Output: # {"a":1} <- int # {"a":null} ``` However, in pandas 2.2.0, `DataFrame#to_json` outputs `Int64` integers as JSON *floats* for columns containing `NA`, as shown below. ```python # pandas 2.2.0 import pandas as pd df = pd.DataFrame({"a": [1, pd.NA]}, dtype="Int64") json = df.to_json(orient="records", lines=True) print(json) # Output: # {"a":1.0} <- float! # {"a":null} ``` Note that even in 2.2.0, `Int64` column values that do *not* contain any `NA` are output as JSON integers as expected. ```python # pandas 2.2.0 import pandas as pd df = pd.DataFrame({"a": [1, 2]}, dtype="Int64") json = df.to_json(orient="records", lines=True) print(json) # Output: # {"a":1} <- int # {"a":2} <- int ``` This problem also occurs in `Series` as follows. ```python s = pd.Series([1, pd.NA], dtype="Int64") print(s.to_json(orient="records")) # Output: # [1.0,null] # ^ # float ``` ### Expected Behavior As in pandas 2.1.4, `Int64` column values should be output as JSON integers even if they contain `NA`. ```python import pandas as pd df = pd.DataFrame({"a": [1, pd.NA]}, dtype="Int64") json = df.to_json(orient="records", lines=True) print(json) # Expected output: # {"a":1} <- int # {"a":null} ``` ### Installed Versions <details> ``` INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.12.1.final.0 python-bits : 64 OS : Darwin OS-release : 22.6.0 Version : Darwin Kernel Version 22.6.0: Sun Dec 17 22:12:45 PST 2023; root:xnu-8796.141.3.703.2~2/RELEASE_ARM64_T6000 machine : arm64 processor : arm byteorder : little LC_ALL : en_US.UTF-8 LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.3.1 Cython : None pytest : 7.4.4 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : None pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : 2023.12.2 gcsfs : 2023.12.2post1 matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : 0.20.0 pyarrow : 15.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.12.0 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None ``` </details>
[ "Regression", "IO JSON" ]
0
0
0
0
0
0
0
0
[]
2,116,463,548
57,223
DOC: Replace pandas logo with a conditional image for light and dark …
closed
2024-02-03T12:29:31
2024-02-04T18:11:28
2024-02-04T18:11:18
https://github.com/pandas-dev/pandas/pull/57223
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57223
https://github.com/pandas-dev/pandas/pull/57223
LakshmanKishore
2
...themes Replaced the static pandas logo with a `picture` tag that displays a different logo based on the color scheme. In light mode, the original logo is shown, while in dark mode, a white version of the logo is displayed for better visibility. In GitHub Dark Theme ![image](https://github.com/pandas-dev/pandas/assets/61258323/a820a065-29d9-489a-b6f8-1e9d68bb5e57) In GitHub Light Theme ![image](https://github.com/pandas-dev/pandas/assets/61258323/66ff39ee-8f6f-4271-9cf6-16d7ba229717)
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thank you for the feedback, I'm glad you found the change helpful! \r\nLooking forward to do more contributions!", "Thanks @LakshmanKishore " ]
2,116,253,943
57,222
ENH: Add all warnings check to the assert_produces_warnings, and separate messages for each warning.
closed
2024-02-03T05:30:15
2024-04-14T19:18:34
2024-04-14T19:18:21
https://github.com/pandas-dev/pandas/pull/57222
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57222
https://github.com/pandas-dev/pandas/pull/57222
Jorewin
9
The function in question gets used in multiple places, that's why I felt it would be safer to preserve current behavior and API, and add an additional, optional parameter, which alters the behavior, enabling checking if all passed warning types get detected. - [x] closes #56555 (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.
[ "Testing", "Warnings" ]
0
0
0
0
0
0
0
0
[ "@rhshadrach Could you review this? Or direct me to someone who can? It's my first contribution here, so I don't know who to ask.", "I should be able to get to this tomorrow.", "@rhshadrach Could you take another look at this, when you have time? I addressed all change requests and resolved all merge conflicts. The docstring checks seem to still be failing, but it looks unrelated to the changes introduced in this PR.", "@rhshadrach I just applied a patch that fixed the python 3.9 unit test not passing. With this, this should be ready for review.", "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.", "@Jorewin - are you interested in finishing this up? If not, I can add some tests to get it over the finish line.", "@rhshadrach If you want to, then go ahead. I just didn't have much time lately.", "@mroeschke - tests added for various combinations. Let me know if you see any others to add.", "Thanks @Jorewin and @rhshadrach " ]
2,116,237,901
57,221
TST: Reduce parameterization of test_str_find_e2e
closed
2024-02-03T05:09:15
2024-02-03T18:00:18
2024-02-03T18:00:15
https://github.com/pandas-dev/pandas/pull/57221
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57221
https://github.com/pandas-dev/pandas/pull/57221
mroeschke
0
This recently added test creates 25k tests and looks to add an extra 6-7 minutes in the CI. Reducing the coverage here to speed the test up
[ "Testing" ]
0
0
0
0
0
0
0
0
[]
2,116,151,590
57,220
CI: Fix using "python" instead of "sys.executable"
closed
2024-02-03T03:25:52
2024-02-03T22:21:13
2024-02-03T11:30:00
https://github.com/pandas-dev/pandas/pull/57220
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57220
https://github.com/pandas-dev/pandas/pull/57220
jrmylow
0
- [x] closes #57219 - [ ] [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.
[ "Bug", "CI" ]
0
0
0
0
0
0
0
0
[]
2,116,151,440
57,219
BUG: validate_docstring uses main python executable instead of sys.executable
closed
2024-02-03T03:25:24
2024-02-03T11:30:01
2024-02-03T11:30:01
https://github.com/pandas-dev/pandas/issues/57219
true
null
null
jrmylow
0
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python Check: pip freeze > t.out and make sure flake8 is uninstalled from the main python environment Run: python scripts/validate_docstrings.py pandas.set_option() Error: Traceback (most recent call last): File "...\scripts\validate_docstrings.py", line 474, in <module> main( File "...\scripts\validate_docstrings.py", line 417, in main print_validate_one_results(func_name) File "...\scripts\validate_docstrings.py", line 386, in print_validate_one_results result = pandas_validate(func_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "...\scripts\validate_docstrings.py", line 262, in pandas_validate for error_code, error_message, line_number, col_number in doc.validate_pep8(): File "...\scripts\validate_docstrings.py", line 211, in validate_pep8 line_number, col_number, error_code, message = error_message.split( ``` ### Issue Description When trying to run docstring tests in `scripts/validate_docstring` the script would fail in calling `validate_pep8`. The error message would say that flake8 was not installed and the function would fail because this error message is not in the expected format to be parsed with `.split()`. The root cause is that the function passes `"python"` instead of `sys.executable` to `subprocess.run`. Because my main python environment is barebones, it doesn't include flake8. Note that in other instances where `subprocess.run` is used in pandas, `sys.executable` is passed in. ### Expected Behavior Script should output the docstrings/validation errors as per normal behaviour. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : 1d1672d1ecb5d108e45338de837d0604edba2859 python : 3.12.1.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 140 Stepping 2, GenuineIntel byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : English_Australia.1252 pandas : 2.2.0.dev0+1177.g1d1672d1ec numpy : 1.26.3 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.3.2 Cython : 3.0.8 pytest : 8.0.0 hypothesis : 6.97.4 sphinx : 7.2.6 blosc : None feather : None xlsxwriter : 3.1.9 lxml.etree : 5.1.0 html5lib : 1.1 pymysql : 1.4.6 psycopg2 : 2.9.9 jinja2 : 3.1.3 IPython : 8.21.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : 1.3.7 dataframe-api-compat : None fastparquet : 2023.10.1 fsspec : 2023.12.2 gcsfs : 2023.12.2post1 matplotlib : 3.8.2 numba : 0.59.0 numexpr : 2.9.0 odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : 15.0.0 pyreadstat : 1.2.6 python-calamine : None pyxlsb : 1.0.10 s3fs : 2023.12.2 scipy : 1.12.0 sqlalchemy : 2.0.25 tables : 3.9.2 tabulate : 0.9.0 xarray : 2024.1.1 xlrd : 2.0.1 zstandard : 0.22.0 tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "CI" ]
0
0
0
0
0
0
0
0
[]
2,116,101,792
57,218
BUG: Fixing broken link in getting_started.md
closed
2024-02-03T01:17:04
2024-02-03T01:23:06
2024-02-03T01:23:00
https://github.com/pandas-dev/pandas/pull/57218
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57218
https://github.com/pandas-dev/pandas/pull/57218
chrish935
1
- [x] closes #57217 - [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit)
[ "Web" ]
0
0
0
0
0
0
0
0
[ "Thanks @chrish935 " ]
2,115,946,954
57,217
WEB: Broken link to Anaconda
closed
2024-02-02T22:48:44
2024-02-03T01:23:01
2024-02-03T01:23:01
https://github.com/pandas-dev/pandas/issues/57217
true
null
null
rhshadrach
1
At https://pandas.pydata.org/getting_started.html, the link to Anaconda in step 1 is broken and should point to https://www.anaconda.com/download.
[ "good first issue", "Web" ]
0
0
0
0
0
0
0
0
[ "take" ]
2,115,839,284
57,216
ENH: In sort methods, accept sequence or dict as key
closed
2024-02-02T21:37:00
2024-08-24T19:47:24
2024-08-24T19:47:24
https://github.com/pandas-dev/pandas/issues/57216
true
null
null
gsehrlich
2
### Feature Type - [X] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description Pretty much every time I use the `key` kwarg of a pandas sort method, I use it to tell pandas the desired order of the unique values. For example: ```python import pandas as pd my_index = pd.Index(['one', 'two', 'three', 'three', 'two', 'one', 'three']) my_index.sort_values( key=lambda idx: (idx .to_series() .rename(index={'one': 1, 'two': 2, 'three': 3}) .index ) ) ``` This is all a bit redundant, and I suspect it's a common use case. Relatedly, sometimes I want to use a different key function for different columns/levels. In order to do that, I actually need to call the sort method multiple times. ### Feature Description Accept sequences like `['one', 'two', 'three']` specifying the ascending order of the values. EDIT: Example equivalent to the `sort_values` call above: ```python my_index.sort_values(key=['one', 'two', 'three']) ``` Also accept dictionaries like `{'col_1': ['one', 'two', 'three'], 'col_3': my_sort_fn}` to sort different columns or levels with different keys in any format. ### Alternative Solutions Make sure all data that I want to lexsort is always an ordered Categorical. ### Additional Context _No response_
[ "Enhancement", "Index", "Needs Triage", "Sorting" ]
0
0
0
0
0
0
0
0
[ "Thanks for the request. You can accomplish this with map, argsort, and take:\r\n\r\n```\r\nmy_index = pd.Index(['one', 'two', 'three', 'three', 'two', 'one', 'three'])\r\nprint(my_index.take(my_index.map({'one': 1, 'two': 2, 'three': 3}).argsort()))\r\n\r\n# Result:\r\n# Index(['one', 'one', 'two', 'two', 'three', 'three', 'three'], dtype='object')\r\n```", "Thanks for the issue, but it appears this hasn't gotten traction in a while so closing" ]
2,115,764,905
57,215
BUG: Error when trying to use `pd.date_range`
open
2024-02-02T20:39:36
2025-06-02T17:12:13
null
https://github.com/pandas-dev/pandas/issues/57215
true
null
null
khider
8
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example Edit[rhshadrach]: On pandas >= 3.0, you need to use `freq='1000000000YS-JAN'` below. ```python import pandas as pd import numpy as np pd.date_range(start = np.datetime64('500000000-01-01', 's'), end = np.datetime64('1500000000-01-01', 's'), freq='1000000000AS-JAN', unit='s') ``` ### Issue Description Error: raise ValueError(f"Offset {offset} did not increment date") ValueError: Offset <YearBegin: month=1> did not increment date ### Expected Behavior Create my date range ### Installed Versions INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.7.final.0 python-bits : 64 OS : Darwin OS-release : 23.1.0 Version : Darwin Kernel Version 23.1.0: Mon Oct 9 21:32:11 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T6030 machine : arm64 processor : arm byteorder : little LC_ALL : en_US.UTF-8 LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.3.1 Cython : None pytest : 8.0.0 hypothesis : None sphinx : 5.0.2 blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.20.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.2 bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.8.2 numba : 0.58.1 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 15.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.12.0 sqlalchemy : None tables : None tabulate : 0.9.0 xarray : None xlrd : 2.0.1 zstandard : None tzdata : 2023.4 qtpy : 2.4.1 pyqt5 : None
[ "Bug", "Regression", "datetime.date" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report; it's not clear to me if `date_range` should be able to handle values at this scale. Further investigations are welcome.\r\n\r\ncc @MarcoGorelli ", "This error came up as part of CI testing of a package. See here: https://github.com/LinkedEarth/Pyleoclim_util/blob/bf9716c22329b6bdefc2c9c2a39dc4982289ad5a/pyleoclim/tests/test_core_Series.py#L1274\r\n\r\nThe tests used to work so it was supported in previous versions of Pandas.\r\n\r\nJust to confirm, it works with dates in the ~1500. ", "Thanks for adding that, best to always indicate it's a regression! That said, I'm seeing this fail in pandas 2.1.0 and pandas 2.0.0. Prior to that, `pd.date_range` did not take the `unit` argument.\r\n\r\nCan you produce an environment where the example is successful, and report the output of `pd.show_versions()`?", "Tried it on our JupyterHub and it worked (although note that this was before `AS` deprecation warning).\r\n\r\n![image](https://github.com/pandas-dev/pandas/assets/11758571/29e55f7e-4e0c-46ea-8f59-99366fb6e09c)\r\n\r\nOutput of `pd.show_versions()`:\r\n\r\n\r\n```INSTALLED VERSIONS\r\n------------------\r\ncommit : 965ceca9fd796940050d6fc817707bba1c4f9bff\r\npython : 3.10.11.final.0\r\npython-bits : 64\r\nOS : Linux\r\nOS-release : 5.15.120+\r\nVersion : #1 SMP Fri Jul 21 03:39:30 UTC 2023\r\nmachine : x86_64\r\nprocessor : x86_64\r\nbyteorder : little\r\nLC_ALL : en_US.UTF-8\r\nLANG : en_US.UTF-8\r\nLOCALE : en_US.UTF-8\r\n\r\npandas : 2.0.2\r\nnumpy : 1.23.5\r\npytz : 2023.3\r\ndateutil : 2.8.2\r\nsetuptools : 68.0.0\r\npip : 23.1.2\r\nCython : 0.29.35\r\npytest : None\r\nhypothesis : None\r\nsphinx : None\r\nblosc : None\r\nfeather : None\r\nxlsxwriter : None\r\nlxml.etree : 4.9.2\r\nhtml5lib : None\r\npymysql : None\r\npsycopg2 : None\r\njinja2 : 3.1.2\r\nIPython : 8.14.0\r\npandas_datareader: None\r\nbs4 : 4.12.2\r\nbottleneck : None\r\nbrotli : \r\nfastparquet : None\r\nfsspec : 2023.6.0\r\ngcsfs : None\r\nmatplotlib : 3.7.1\r\nnumba : 0.57.1\r\nnumexpr : None\r\nodfpy : None\r\nopenpyxl : None\r\npandas_gbq : None\r\npyarrow : 12.0.0\r\npyreadstat : None\r\npyxlsb : None\r\ns3fs : 2023.6.0\r\nscipy : 1.10.1\r\nsnappy : None\r\nsqlalchemy : 2.0.15\r\ntables : None\r\ntabulate : 0.9.0\r\nxarray : 2023.5.0\r\nxlrd : 2.0.1\r\nzstandard : None\r\ntzdata : 2023.3\r\nqtpy : 2.3.1\r\npyqt5 : None\r\nNone\r\n```\r\nThe container is available here: https://quay.io/repository/linkedearth/linkedearthhub?tab=tags\r\n\r\nLatest tag should work. The problem with the GitHub tests is very new. It was passing as of a week ago. Unfortunately, we don't pin versions for CI so I have no idea what was actually installed then. ", "Thanks - I've edited the OP to be `AS` for now. I was able to confirm on 2.0.2 but could not run a git-bisect due to the change in build systems. @phofl - I recall you had a solve for this?\r\n\r\nFurther investigations and PRs to fix are welcome!", "Inside `pandas/core/arrays/datetimes.py:_generate_range`, when applying the offset to the current date\r\n\r\n```py\r\nnext_date = offset._apply(cur)\r\n```\r\n\r\nAs `Timestamp cur` is converted to cython object `_Timestamp`, its year is set to 1972. See `pandas/_libs/tslibs/timestamps.pyx:create_timestamp_from_ts`\r\n\r\nThe change originates from https://github.com/pandas-dev/pandas/pull/47720. Don't really know where to go next tho. Maybe depends on how we want to handle out-of-bound pydatetime\r\n\r\n", "cc @jbrockmendel", "Looks like the issue is in shift_month. Changing `year = stamp.year + dy` to `year = (<object>stamp).year + dy` seems to fix it. That isn't a great solution though. Might be preferable to change the declaration on shift_month from datetime to _Timestamp, though i expect that will take more work." ]
2,115,685,556
57,214
ENH: pd.Series.str.isempty() to check for empty strings
closed
2024-02-02T20:03:53
2024-02-07T21:23:03
2024-02-07T17:34:31
https://github.com/pandas-dev/pandas/issues/57214
true
null
null
michaelquinn32
3
### Feature Type - [X] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description The current pattern for empty strings is to do an equals comparion ```python strings = pd.Series(['a', '', 'b']) strings == '' ``` There are often recommendations to check truthiness of strings with implicit boolean values, e.g. https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/use-implicit-booleaness-not-comparison.html This method would be similar to other string checking patterns, like `pd.Series.str.isspace()`. While this does deviate from the existing str api that the methods seek to follow, the approach from the str api to checking strings fails because pd.Series objects don't have an implicit truth value. This would also make more fluid to combine operations: ```python strings.mask(strings.str.isempty() | strings.str.isspace(), 'empty') ``` ### Feature Description In [pandas/core/strings/object_array.py](https://github.com/pandas-dev/pandas/blob/4f0870efecff989c211dd8cfe975ef2127cc86b8/pandas/core/strings/object_array.py#L4) ```python def _str_isempty(self): return self._str_map(lambda s: s == '', dtype="bool") ``` ### Alternative Solutions N/A ### Additional Context _No response_
[ "Enhancement", "Strings", "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "Thanks for the request. The link to pylint warns about behavior differences using `==` or `!=` as compared to implicit truthiness of objects. If I'm understanding this request correctly, it is asking for another way to test equality to the empty string. Users would be able to do:\r\n\r\n strings == ''\r\n strings.eq('') # Great for method chaining\r\n strings.str.len() == 0\r\n strings.str.len().eq(0)\r\n \r\n # And now\r\n strings.str.isempty()\r\n\r\nand these would all result in precisely the same behavior. It would expand the size of the API and the maintenance that comes along with it, without providing any new behavior users could take advantage of. For this reason, I'm rather negative on the proposal.", "Thanks for getting back to me, and thanks for taking them time to look through this in detail.\r\n\r\n`.eq('')` is probably close enough in intent to the original ask, as it can clarify to the reader (human or machine) that this isn't exactly the same as the standard string comparison. I'm a little embarrassed to say that I wasn't aware of this option when making the request.\r\n\r\nI'll close this issue.", "> I'm a little embarrassed to say that I wasn't aware of this option\r\n\r\nYou shouldn't be! The pandas API is quite large, core maintainers do not know it all - and we certainly don't expect users to!" ]
2,115,536,364
57,213
BUG: to_numeric loses precision when converting decimal type to integer
open
2024-02-02T18:34:30
2024-02-27T10:06:14
null
https://github.com/pandas-dev/pandas/issues/57213
true
null
null
sfc-gh-aalam
3
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python from decimal import * import pandas as pd df = pd.DataFrame({'column1': [Decimal('1'*19)]}) print(pd.to_numeric(df['column1'], downcast='integer')) print(df['column1'].astype('int64')) """ 0 1111111111111111168 Name: column1, dtype: int64 0 1111111111111111111 Name: column1, dtype: int64 """ ``` ### Issue Description When converting data from decimal type to integer using `to_numeric`, we see loss of precision where as doing the same conversion using `astype('int64')` works as expected without any precision loss. ### Expected Behavior Perform the conversion without a precision loss ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.9.16.final.0 python-bits : 64 OS : Darwin OS-release : 23.2.0 Version : Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.24.2 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 65.6.3 pip : 23.0.1 Cython : 0.29.34 pytest : None hypothesis : None sphinx : 5.0.2 blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : None pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.8.2 numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 10.0.1 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.2 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "Dtype Conversions" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. We likely go through float64. Further investigations and PRs to fix are welcome!", "I'll be attempting this.", "take" ]
2,114,982,768
57,212
BUG: ensure_string_array might modify read-only array inplace
closed
2024-02-02T13:51:24
2024-02-04T18:16:05
2024-02-04T18:15:37
https://github.com/pandas-dev/pandas/pull/57212
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57212
https://github.com/pandas-dev/pandas/pull/57212
phofl
1
We ran into this in Dask, it's quite the edge case...
[ "Bug", "Strings" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,114,361,376
57,211
DOC: fix PR02 errors in docstrings - pandas.core.window.rolling.Rolling.quantile, pandas.core.window.expanding.Expanding.quantile
closed
2024-02-02T08:14:40
2024-02-02T17:59:49
2024-02-02T11:59:14
https://github.com/pandas-dev/pandas/pull/57211
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57211
https://github.com/pandas-dev/pandas/pull/57211
jordan-d-murphy
1
All PR02 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.window.rolling.Rolling.quantile 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.window.expanding.Expanding.quantile OUTPUT: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.window.rolling.Rolling.quantile ``` ################################################################################ ################################## Validation ################################## ################################################################################ 5 Errors found for `pandas.core.window.rolling.Rolling.quantile`: ES01 No extended summary found SA05 pandas.Series.rolling in `See Also` section does not need `pandas` prefix, use Series.rolling instead. SA05 pandas.DataFrame.rolling in `See Also` section does not need `pandas` prefix, use DataFrame.rolling instead. SA05 pandas.Series.quantile in `See Also` section does not need `pandas` prefix, use Series.quantile instead. SA05 pandas.DataFrame.quantile in `See Also` section does not need `pandas` prefix, use DataFrame.quantile instead. ``` 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.window.expanding.Expanding.quantile ``` ################################################################################ ################################## Validation ################################## ################################################################################ 5 Errors found for `pandas.core.window.expanding.Expanding.quantile`: ES01 No extended summary found SA05 pandas.Series.expanding in `See Also` section does not need `pandas` prefix, use Series.expanding instead. SA05 pandas.DataFrame.expanding in `See Also` section does not need `pandas` prefix, use DataFrame.expanding instead. SA05 pandas.Series.quantile in `See Also` section does not need `pandas` prefix, use Series.quantile instead. SA05 pandas.DataFrame.quantile in `See Also` section does not need `pandas` prefix, use DataFrame.quantile instead. ``` - [x] xref https://github.com/pandas-dev/pandas/issues/57111 - [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.
[ "Docs", "Clean" ]
0
0
0
0
0
0
0
0
[ "Thanks @jordan-d-murphy, nice update" ]
2,114,232,620
57,210
DOC: fix PR02 errors in docstrings - pandas.core.groupby.SeriesGroupBy.transform and pandas.core.groupby.DataFrameGroupBy.transform
closed
2024-02-02T06:55:29
2024-02-02T17:59:26
2024-02-02T11:51:19
https://github.com/pandas-dev/pandas/pull/57210
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57210
https://github.com/pandas-dev/pandas/pull/57210
jordan-d-murphy
1
All PR02 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.SeriesGroupBy.transform 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.DataFrameGroupBy.transform OUTPUT: 1. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.SeriesGroupBy.transform ``` ################################################################################ ################################## Validation ################################## ################################################################################ 1 Errors found for `pandas.core.groupby.SeriesGroupBy.transform`: RT03 Return value has no description ``` 2. scripts/validate_docstrings.py --format=actions --errors=PR02 pandas.core.groupby.DataFrameGroupBy.transform ``` ################################################################################ ################################## Validation ################################## ################################################################################ 1 Errors found for `pandas.core.groupby.DataFrameGroupBy.transform`: RT03 Return value has no description ``` - [x] xref https://github.com/pandas-dev/pandas/issues/57111 - [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.
[ "Docs", "Clean" ]
0
0
0
0
0
0
0
0
[ "Thanks @jordan-d-murphy, very nice" ]
2,114,190,022
57,209
BUG: qcut bins error
closed
2024-02-02T06:30:59
2024-02-06T02:13:25
2024-02-03T11:59:20
https://github.com/pandas-dev/pandas/issues/57209
true
null
null
0x30
6
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python res, bins = pd.qcut([500, 600, 600, 500, 600, 1000, 2000, 3000], q=2, retbins=True) print(res, bins) res = pd.cut([500, 600, 600, 500, 600, 1000, 2000, 3000], bins=bins) print(res) ``` ### Issue Description ```python res, bins = pd.qcut([500, 600, 600, 500, 600, 1000, 2000, 3000], q=2, retbins=True) res, bins # ([(499.999, 600.0], (499.999, 600.0], (499.999, 600.0], (499.999, 600.0], (499.999, 600.0], (600.0, 3000.0], (600.0, 3000.0], (600.0, 3000.0]] # Categories (2, interval[float64, right]): [(499.999, 600.0] < (600.0, 3000.0]], # array([ 500., 600., 3000.])) ``` ```python pd.cut([500, 600, 600, 500, 600, 1000, 2000, 3000], bins=bins) # [NaN, (500.0, 600.0], (500.0, 600.0], NaN, (500.0, 600.0], (600.0, 3000.0], (600.0, 3000.0], (600.0, 3000.0]] # Categories (2, interval[float64, right]): [(500.0, 600.0] < (600.0, 3000.0]] ``` ![image](https://github.com/pandas-dev/pandas/assets/6121524/22af0411-b34a-4894-836e-9148118df054) ### Expected Behavior `bins` should start `499.999 ` ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.3.final.0 python-bits : 64 OS : Darwin OS-release : 23.3.0 Version : Darwin Kernel Version 23.3.0: Wed Dec 20 21:28:58 PST 2023; root:xnu-10002.81.5~7/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : zh_CN.UTF-8 LOCALE : zh_CN.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 66.0.0 pip : 23.0.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : 1.0.3 psycopg2 : None jinja2 : None IPython : 8.13.2 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.8.2 numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : 2.0.13 tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "Duplicate Report", "cut" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Closing as a duplicate of #51532.", "hello @rhshadrach . I'm sorry, personally I think it's not that the cut accuracy is inaccurate, but rather that qcut gave the wrong bins. I'm not very sure if this is the same mistake\r\n\r\nI think what qcut should return in the above example is `array([ 499.99., 600., 3000.]))`\r\n", "From that issue:\r\n\r\n> NOTE 1: The same problem exists with `pd.qcut` which cuts the data into buckets based on data quantiles. In that case it could be argued that that is desirable, so that you have the correct proportion of data in each bin. E.g. if using the quartiles, then the way it currently works means that 25% of the data will get into each bucket. Whereas the way I am suggesting, you can get more or less data in each bucket. However that argument isn't very strong with pd.cut. And in any case, I think that correctly binning data should always be the primary consideration, and size of bins secondary to that.\r\n\r\nYour result separates the data into two bins each of size 3 - satisfying `q=2` but at the expense of not binning certain data points. I think that makes this the same issue.\r\n\r\nLet me know if you still disagree!", "Sorry to bother you\r\n\r\nPerhaps there are also issues with cut, but I think the problem I am currently facing should be due to the incorrect bins returned by qcut, or the fact that pandas were originally designed in this way is that I misunderstood the usage method and caused the error\r\n\r\nin [qcut document](https://github.com/pandas-dev/pandas/blob/46fd7114d6ded7dcd58499776175d4ccfd04d9da/pandas/core/reshape/tile.py#L319)\r\n\r\n```\r\nExamples\r\n--------\r\n>>> pd.qcut(range(5), 4)\r\n... # doctest: +ELLIPSIS\r\n[(-0.001, 1.0], (-0.001, 1.0], (1.0, 2.0], (2.0, 3.0], (3.0, 4.0]]\r\nCategories (4, interval[float64, right]): [(-0.001, 1.0] < (1.0, 2.0] ...\r\n```\r\nuse qcut will return right close interval `Categories (4, interval[float64, right]): [(-0.001, 1.0] < (1.0, 2.0]` \r\n\r\nHere is what I want to do. I have a batch of data here, and i hope `quct` group data and give me `bins`, i use `bins` to group other data\r\n\r\n```python\r\nres, bins = pd.qcut([1, 2], q=2, retbins=True)\r\n\r\n# get result\r\n# ([(0.999, 1.5], (1.5, 2.0]]\r\n# Categories (2, interval[float64, right]): [(0.999, 1.5] < (1.5, 2.0]],\r\n# array([1. , 1.5, 2. ]))\r\n```\r\n\r\nand use qcut return bins to exec `pd.cut([1,2], bins = bins)` get\r\n\r\n```\r\npd.cut([1, 2], bins=bins)\r\n\r\n# get result\r\n# [NaN, (1.5, 2.0]]\r\n# Categories (2, interval[float64, right]): [(1.0, 1.5] < (1.5, 2.0]]\r\n```\r\n\r\nI didn't get the result I wanted until I used `include_lowest`\r\n\r\n```python\r\npd.cut([1, 2], bins=bins, include_lowest=True)\r\n\r\n# get result\r\n# [(0.999, 1.5], (1.5, 2.0]]\r\n# Categories (2, interval[float64, right]): [(0.999, 1.5] < (1.5, 2.0]]\r\n```\r\n\r\nI hope qcut will return me `[0.999, 1.5, 2.0]` by default.\r\n\r\nI'm not sure if this is a problem or if Pandas was originally designed this way\r\n", "> Perhaps there are also issues with cut, but I think the problem I am currently facing should be due to the incorrect bins returned by qcut\r\n\r\nNo disagreement there. Issue #51532 is also about qcut, as I quoted above.", "👌" ]
2,114,019,485
57,208
REF: Remove internals.base
closed
2024-02-02T04:16:15
2024-02-02T18:15:12
2024-02-02T17:53:30
https://github.com/pandas-dev/pandas/pull/57208
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57208
https://github.com/pandas-dev/pandas/pull/57208
rhshadrach
1
- [x] closes #57187 (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.
[ "Refactor", "Internals" ]
0
0
0
0
0
0
0
0
[ "Thanks @rhshadrach " ]
2,113,973,484
57,207
DEPR: Enforce deprecation of groupby(...).grouper
closed
2024-02-02T03:32:27
2024-02-02T23:00:53
2024-02-02T22:54:29
https://github.com/pandas-dev/pandas/pull/57207
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57207
https://github.com/pandas-dev/pandas/pull/57207
rhshadrach
1
- [ ] 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. Enforces #56521
[ "Groupby" ]
0
0
0
0
0
0
0
0
[ "Thanks @rhshadrach " ]
2,113,964,521
57,206
DOC: Fix minor typo in indexing.rst
closed
2024-02-02T03:24:56
2024-02-04T03:49:02
2024-02-02T12:00:41
https://github.com/pandas-dev/pandas/pull/57206
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57206
https://github.com/pandas-dev/pandas/pull/57206
chris-hewitt
1
- [ ] 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.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks for fixing this @chris-hewitt " ]
2,113,909,202
57,205
PERF: Avoid Series constructor in DataFrame(dict(...), columns=)
closed
2024-02-02T02:36:52
2024-02-24T00:13:55
2024-02-24T00:13:52
https://github.com/pandas-dev/pandas/pull/57205
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57205
https://github.com/pandas-dev/pandas/pull/57205
mroeschke
3
- [ ] closes #24368 (Replace xxxx with the GitHub issue number) - [ ] closed #25887 - [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature. ```python import pandas as pd, numpy as np a = pd.Series(np.array([1, 2, 3])) columns = range(10_000) data = {i: a for i in columns} %timeit pd.DataFrame(data, columns=columns) 51.3 ms ± 96 µs per loop (mean ± std. dev. of 7 runs, 10 loops each) # PR 102 ms ± 1.8 ms per loop (mean ± std. dev. of 7 runs, 10 loops each) # main ``` ```python In [1]: import pandas as pd In [2]: %timeit pd.DataFrame([], columns=['a']) 37.3 µs ± 231 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each) # PR 183 µs ± 584 ns per loop (mean ± std. dev. of 7 runs, 10,000 loops each) # main ```
[ "Performance", "DataFrame" ]
0
0
0
0
0
0
0
0
[ "When you have a chance, could you take a look @jbrockmendel ", "will take a look. i like the idea of getting Series out of here", "LGTM" ]
2,113,870,822
57,204
PDEP-14: Publish translations of pandas.pydata.org
closed
2024-02-02T01:53:51
2024-02-27T19:09:50
2024-02-27T19:09:50
https://github.com/pandas-dev/pandas/pull/57204
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57204
https://github.com/pandas-dev/pandas/pull/57204
steppi
16
Following up on the discussion in #56301, this PR adds a first draft for a PDEP proposing creation and publication of translations of the core website content. To summarize, the [Scientific Python community and communications infrastructure grant](https://scientific-python.org/doc/scientific-python-community-and-communications-infrastructure-2022.pdf) is supporting work to facilitate official translation of content from the websites of [Scientific Python core projects](https://scientific-python.org/specs/core-projects/) and publication of these translations. This PDEP proposes that Pandas participates in these efforts. The hope is that the bulk of the work would be taken on by myself and/or a colleague at Quansight, and the work required by Pandas maintainers would be minimal. There's more information in the PDEP below. Thank you. Looking forward to hearing your feedback.
[ "PDEP" ]
0
0
0
0
0
0
0
0
[ "cc @pandas-dev/pandas-core ", "Thanks for putting this together @steppi, nice start. I'm fine with the general idea, but being honest, not a fan of the PDEP as it is now.\r\n\r\nI may be wrong, but I don't think we need so much context on why translations are useful. This is going to be reviewed by many people, and to me feels like everything in the PDEP except the implementation part could be summarized in a paragraph, making the review of the PDEP much faster.\r\n\r\nAlso, I don't think the PDEP should be opinionated on what exact pages should be translated. In my opinion we want to define what's made available to be translated, and that's it. Then if you work on some of the translations as part of the grant, surely feel free to skip the roadmap or whatever it doesn't make sense.\r\n\r\nI don't fully understand about the mirror, maybe you can expand on why a mirror is useful.\r\n\r\nFinally, feels like your idea is to create files such as `web/pandas/it/getting_started.md` or `web/pandas/zh/about/team.md` in this same repo with the content translated. I'm a strong -1 on this. We can synchronize the translations in our production repository directly from somewhere else. I'm -1 on anything that involves having translated content in this repo.\r\n\r\nNot sure if the idea is to generate `.po` / `.mo` files or to have a full copy of the markdown files for each translation, but whatever it is it can be kept separately, and we can fetch it from somewhere else when we build our website, so we have the translated files published. I don't think there is added value on moving translated context to this repo.", "Thanks for the pointed criticism @datapythonista. I’m just trying to get the ball rolling and would have been surprised to produce a good proposal on the first go honestly. I’ll take your feedback into account and make revisions.", "> Finally, feels like your idea is to create files such as `web/pandas/it/getting_started.md` or `web/pandas/zh/about/team.md` in this same repo with the content translated. I'm a strong -1 on this. We can synchronize the translations in our production repository directly from somewhere else. I'm -1 on anything that involves having translated content in this repo.\r\n\r\nyep, at first glance, this appears to be a major stumbling block.\r\n\r\nI see many web sites that warn of external content, so I guess that any links from the pandas web site to translated content would need something similar.\r\n\r\nI don't think it is realistic to expect pandas core maintainers to approve changes/ merge PRs they do not understand. Even if we have some maintainers that are comfortable with some other languages, this still reduces the bandwidth available for approval and discussion.", "To be clear, I'm fine to have the translations in for example https://pandas.pydata.org/it/ for Italian.\r\n\r\nWhat I think it's a bad idea that adds zero value and a significant maintenance cost is to have translated texts in this repo. The CI process can download translations from `.po` files, from translated markdown files or from whatever, render the website with them, and publish the website with the translations. I don't see how having translated content in this repo if the pandas maintainers and the translators are different groups of people is helpful in any way.", "Thank you @datapythonista and @simonjayhawkins for your feedback. I've produced an updated version of the proposal incorporating your suggestions. I've removed all of the extra-fluff and replaced it with a one paragraph summary that I hope hits upon the key points, removed the opinions on what should be translated, removed the suggestions to host translated content on the Pandas website itself and removed everything else that would be onerous for Pandas maintainers.", "Thanks for the update and the flexibility @steppi, this looks much better.\r\n\r\nNot sure if you agree, but seems like the proposal goes into many technical details in some things (like already deciding to use crowdin over other options, the need to clone the repo...). And at the same time the process is very unclear. I tried to watch a video on how is the workflow in crowdin, but in their website they'll make me register, and in youtube I couldn't find a short video to understand the process. I watched few, but they all cover the crowdin dashboard.\r\n\r\nDo you think in this PDEP we want to already agree in the technical solution, or we just want to agree on moving forward with the project? Feels like it'd be good to either remove the implementation details, or add a much clearer explanation on what exactly is going to be implemented.\r\n\r\nOther than that, Imy personal preference is to leave the translators parts more open. If there is abuse or problems with the translations, I would look for solutions, but so far I'd start with letting anyone translate anything. I assume the translation software will let us block or revert if ever needed.", "Thanks @datapythonista \r\n\r\n> Not sure if you agree, but seems like the proposal goes into many technical details in some things (like already deciding to use crowdin over other options, the need to clone the repo...). And at the same time the process is very unclear. I tried to watch a video on how is the workflow in crowdin, but in their website they'll make me register, and in youtube I couldn't find a short video to understand the process. I watched few, but they all cover the crowdin dashboard.\r\n\r\nUnderstood. I just saw that the template section heading is **Detailed Implementation** and thought the expectation was to give a high level of detail. If we don't need to settle down the technical details, I think that would be better. The strong bias towards choosing Crowdin is motivated by wanting to have a uniform platform among the different core projects, and the quality of the free support they've been offering. Since it's only been used for NumPy so far, there's still an opportunity to change platform if there's something that would be significantly better. I didn't really understand how Crowdin works until I set up a test project and played around with it. If you'd like, I could do a short call to run through the workflow, or make a short screencast video.\r\n\r\n> Other than that, my personal preference is to leave the translators parts more open. If there is abuse or problems with the translations, I would look for solutions, but so far I'd start with letting anyone translate anything. I assume the translation software will let us block or revert if ever needed.\r\n\r\nI could look into how that would work. I know that it's possible to suggest translations without overriding existing ones. I think having things invite-only doesn't have to add that much friction if approval is prompt and we guaranteed.\r\n", "> Thanks @steppi for the changes.\r\n> \r\n> My current thinking is if this is a funded project with limited scope and duration that maybe a PDEP is not needed after all.\r\n> \r\n> PDEP are for enhancements to the pandas project and processes. It appears that most of this work will be outside of pandas\r\n\r\nThanks @simonjayhawkins. That would be nice if we could forgo the PDEP process. Yes, the plan would be for most of the work to be outside of Pandas.", "> That would be nice if we could forgo the PDEP process.\r\n\r\nhopefully others will give some input on this. If the pandas core maintainers are only required to create some sort of synchronization to the pandas web site then IMHO a PDEP is not needed.\r\n\r\nAnother concern I have that I don't think has yet been mentioned is ensuring that users of the translated documentation are aware where to report issues/suggestions. I assume this is not going to be the main pandas repo.", "> Another concern I have that I don't think has yet been mentioned is ensuring that users of the translated documentation are aware where to report issues/suggestions. I assume this is not going to be the main pandas repo\r\n\r\nGood question. I think such issues/suggestions should be made in the repo hosting the translations. There could be a link to create an issue in that repo among the things listed when someone clicks new issue in pandas. \r\n", "> There could be a link to create an issue in that repo among the things listed when someone clicks new issue in pandas.\r\n\r\nsgtm", "Thanks @Dr-Irv.\r\n\r\n> 1. What work by the pandas team is required up front (i.e., just one time) to support these translations? For example, changes to how the web site is built, or an additional button/menu, etc.\r\n\r\nYes, I think you have this right. It would require changes to how the web site is built and addition of some kind of UI element to switch languages.\r\n\r\n> 2\\. What ongoing support, if any, is required by the pandas team to support these translations?\r\n\r\nAt the moment I can't think of anything that goes beyond my answers to the following questions.\r\n\r\n> 3\\. If someone updates the English version of a page on the pandas web site, how would the translations get updated?\r\nAs I envision it, the repo hosting the translated content will have a github action polling for changes to the English content, and merging them. These changes would then be synced to Crowdin and translators would receive a notification that there are new strings to translate. Pandas maintainers should not be responsible for finding or communicating with translators. We're going to try to build an active translation community that works across the Scientific Python projects.\r\n\r\n> 4\\. Will the translations clearly indicate that issues with the translations should be reported elsewhere?\r\n\r\nYes, I think that's doable. Also, one of the preset options when trying to open a new issue on Pandas could be for issues with translations, and it would link elsewhere.\r\n\r\n> 5\\. Suppose at some point the pandas team decides to reorganize the pandas documentation? Does this need to be coordinated with the translations project?\r\n\r\nPotentially, but I'd hope to make the need for coordination minimal. If its just a reorganization, without significant changes to any of the content selected for translation, this could be sorted out on the translation project side with a few hours work (provided that the content selected for translation is kept reasonably small). It would be good to get a heads up that you're planning a reorganization, but I think I could just set up email filters to notify me about issues or pull requests related to website updates.\r\n\r\nI think you could potentially feel constrained with respect to major or complete changes to the content that's selected for translation though. In that all translations would be lost and it may take time for new ones to be made.", "Hi everyone. While this is still up in the air, is it OK if I get started setting up a mirrored repo with the content and syncing it with Crowdin? There's an open source license request form, https://crowdin.com/page/open-source-project-setup-request, that they'll let me fill out in your place with your permission. The decision for whether or not you want to publish the translations on your website can wait, but in any case I think it would still be valuable for quality translations to exist.", "Thanks for the continued work on this @steppi. This sounds good. I'm personally fine to close this PDEP and have you working on this independently from the main pandas repository. Also, if you want to publish the translated content in for example GitHub pages, I can add a rule to our web server configuration so for example pandas.pydata.org/zh/ serves the Chinese translation you publish there. I guess there may be few challenges here and there, but if this makes sense to you, I personally don't think we need further discussion, build whatever you think it's best, and when things are ready, just let us know how things work, so we can make sure there are no significant concerns in terms of the translations becoming obsolete, people abusing and using the translations to spam...\r\n\r\nOf course if you prefer to continue iterating on this PDEP you are welcome to, but since my understanding is that this is a grant you want to be working on regardless of the decisions here, I personally think it'll make your life easier to build the first version in the best way to you personally, and we give you feedback once we can comment on the specific implementation.\r\n\r\nIf you can get the website translated without core devs having to review PRs with translations or have significant extra maintenance work, it'll be amazing, and I don't think there'll be blockers from anyone.", "Thanks @datapythonista! That sounds good. Feel free to close this issue now. I'll get to work on setting things up for Pandas translations.\r\n\r\n> If you can get the website translated without core devs having to review PRs with translations or have significant extra maintenance work, it'll be amazing, and I don't think there'll be blockers from anyone.\r\n\r\nThat's the goal. The discussion with you and other Pandas devs was very valuable in helping me put together a concrete plan for moving this forward. Thank you to everyone who was involved.\r\n" ]
2,113,847,176
57,203
Backport PR #57174 on branch 2.2.x (BUG: Interchange protocol implementation allows non-string column names)
closed
2024-02-02T01:25:51
2024-02-02T02:38:20
2024-02-02T02:38:20
https://github.com/pandas-dev/pandas/pull/57203
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57203
https://github.com/pandas-dev/pandas/pull/57203
meeseeksmachine
0
Backport PR #57174: BUG: Interchange protocol implementation allows non-string column names
[ "Interchange" ]
0
0
0
0
0
0
0
0
[]
2,113,817,417
57,202
Backport PR #57163 on branch 2.2.x (CI: Add macOS M1 CI)
closed
2024-02-02T00:53:33
2024-02-02T02:37:49
2024-02-02T02:37:48
https://github.com/pandas-dev/pandas/pull/57202
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57202
https://github.com/pandas-dev/pandas/pull/57202
meeseeksmachine
0
Backport PR #57163: CI: Add macOS M1 CI
[ "Build", "CI", "OS X" ]
0
0
0
0
0
0
0
0
[]
2,113,806,810
57,201
CLN: pyproject.toml
closed
2024-02-02T00:42:31
2024-02-02T17:45:03
2024-02-02T17:45:00
https://github.com/pandas-dev/pandas/pull/57201
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57201
https://github.com/pandas-dev/pandas/pull/57201
mroeschke
0
null
[ "Clean" ]
0
0
0
0
0
0
0
0
[]
2,113,432,446
57,200
STY: Enable some passing rules
closed
2024-02-01T20:34:35
2024-02-02T17:43:25
2024-02-02T17:43:22
https://github.com/pandas-dev/pandas/pull/57200
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57200
https://github.com/pandas-dev/pandas/pull/57200
mroeschke
0
null
[ "Code Style" ]
0
0
0
0
0
0
0
0
[]
2,113,365,130
57,199
TST/CLN: Assorted
closed
2024-02-01T20:01:12
2024-02-02T17:43:35
2024-02-02T17:43:33
https://github.com/pandas-dev/pandas/pull/57199
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57199
https://github.com/pandas-dev/pandas/pull/57199
mroeschke
0
Only notable change is bumping up the tolerance in `test_dti_constructor_with_non_nano_now_today` xref https://github.com/pandas-dev/pandas/actions/runs/7746334432/job/21124335580
[ "Testing", "Clean" ]
0
0
0
0
0
0
0
0
[]
2,113,334,460
57,198
Backport PR #57173: BUG: pandas int extension dtypes has no attribute…
closed
2024-02-01T19:45:08
2024-02-01T21:15:40
2024-02-01T21:15:39
https://github.com/pandas-dev/pandas/pull/57198
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57198
https://github.com/pandas-dev/pandas/pull/57198
MarcoGorelli
0
… byteorder - [ ] 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.
[]
0
0
0
0
0
0
0
0
[]
2,113,253,877
57,197
BUG: ValueError: Invalid frequency: ME
closed
2024-02-01T19:02:39
2024-05-02T19:55:28
2024-02-09T09:36:43
https://github.com/pandas-dev/pandas/issues/57197
true
null
null
celestinoxp
2
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python . ``` ### Issue Description I'm testing a pull-request on pycaret https://github.com/pycaret/pycaret/pull/3857 to support new scikit-learn 1.4, and new pandas 2.2.0 also. I fixed/removed deprecated ALIAS of time frequencies, as you can see here: https://github.com/pycaret/pycaret/pull/3857/commits/039f159ab25f22f68d3f0d6820a94c40e3f4173f However as i can see in pandas doccumentation of pandas 2.2 https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#deprecate-aliases-m-q-y-etc-in-favour-of-me-qe-ye-etc-for-offsets, the alias M is changed to ME, but something is wrong because i receive an error because ME is in use... i give you an picture of my vscode: ![image](https://github.com/pandas-dev/pandas/assets/41735311/d98c5934-ad46-48c8-837f-4245b1b5f5e3) As you can see, have an error ValueError: Invalid frequency: ME, failed to parse with error message: ValueError("for Period, please use 'M' instead of 'ME'") but i have pandas 2.2 as you can see (i used terminal to show pandas version) ### Expected Behavior No errors ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.10.13.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22631 machine : AMD64 processor : AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD byteorder : little LC_ALL : None LANG : pt_BR.UTF-8 LOCALE : Portuguese_Portugal.1252 pandas : 2.2.0 numpy : 1.26.3 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.3.2 Cython : 0.29.36 pytest : 7.4.3 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.3 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.3 IPython : 8.20.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.2 bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : 2023.10.0 gcsfs : None matplotlib : 3.8.2 numba : 0.58.1 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.4 sqlalchemy : None tables : None tabulate : 0.9.0 xarray : None xlrd : None zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None </details>
[ "Bug", "Needs Info" ]
2
0
0
0
0
0
0
0
[ "Thanks for the report. Could you provide a reproducible example.", "I'm going to close this issue because it's possible that the problem is with third-party packages" ]
2,112,713,037
57,196
BUG: Dataframe's `to_sql` method fails while trying to persist Dataframe to Postgtres in Version 2.2.0
open
2024-02-01T14:50:31
2025-07-16T09:16:43
null
https://github.com/pandas-dev/pandas/issues/57196
true
null
null
damianr13
4
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd from sqlalchemy import create_engine from .settings import get_settings # pydantic way of reading the env variables conn_string = get_settings().db_conn_string df = pd.DataFrame(range(5), columns=["id"]) db = create_engine(conn_string) conn = db.connect() nr_rows = df.to_sql( "temp_pandas_test", con=conn, if_exists="replace", index=False, chunksize=1000 ) ``` ### Issue Description Exporting a pandas dataframe to Postgres doesn't work anymore in version 2.2.0. The code above works well with version 2.1.2, but in version 2.2.0 it fails with the following error: ``` Traceback (most recent call last): File "/Users/robert-andreidamian/Workspace/panprices/shelf_analytics_update_products/demo.py", line 14, in <module> nr_rows = df.to_sql( File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/util/_decorators.py", line 333, in wrapper return func(*args, **kwargs) File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/core/generic.py", line 3059, in to_sql return sql.to_sql( File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/io/sql.py", line 858, in to_sql return pandas_sql.to_sql( File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/io/sql.py", line 2867, in to_sql table.create() File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/io/sql.py", line 1000, in create if self.exists(): File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/io/sql.py", line 986, in exists return self.pd_sql.has_table(self.name, self.schema) File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/io/sql.py", line 2882, in has_table return len(self.execute(query, [name]).fetchall()) > 0 File "/Users/robert-andreidamian/.local/share/virtualenvs/shelf_analytics_update_products-BwnpeEoI/lib/python3.9/site-packages/pandas/io/sql.py", line 2689, in execute cur = self.con.cursor() AttributeError: 'Connection' object has no attribute 'cursor' ``` I noticed that [a new driver](https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#adbc-driver-support-in-to-sql-and-read-sql) was added in Version 2.2.0, which might be related to my issue. ### Expected Behavior The code above should execute the same way it used to do with the previous version, and export the dataframe to a table in my Postgres Database. ### Installed Versions INSTALLED VERSIONS ------------------ commit : c3014abb3bf2e15fa66d194ebd2867161527c497 python : 3.9.13.final.0 python-bits : 64 OS : Darwin OS-release : 23.1.0 Version : Darwin Kernel Version 23.1.0: Mon Oct 9 21:32:52 PDT 2023; root:xnu-10002.41.9~7/RELEASE_ARM64_T8122 machine : x86_64 processor : i386 byteorder : little LC_ALL : None LANG : None LOCALE : en_GB.UTF-8 pandas : 3.0.0.dev0+210.gc3014abb3b numpy : 1.26.3 pytz : 2023.4 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.3.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 5.1.0 html5lib : None pymysql : None psycopg2 : 2.9.9 jinja2 : 3.1.3 IPython : None pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None
[ "Bug", "IO SQL", "Needs Triage" ]
1
0
0
0
0
0
0
0
[ "cc @WillAyd related to your changes?", "maybe related #57049 and #57178", "Same error here with an **sqlite** database (I get the error with pandas 2.2.0 but not with 2.1.4)", "The issue continues to exist in 2.3 as well. " ]
2,112,687,872
57,195
ENH: Remove value dependent dtype behavior for grouped aggregation for masked and pyarrow dtypes
closed
2024-02-01T14:38:38
2024-02-02T01:24:17
2024-02-02T01:24:17
https://github.com/pandas-dev/pandas/issues/57195
true
null
null
rohanjain101
1
### Feature Type - [ ] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [X] Removing existing functionality in pandas ### Problem Description ``` >>> a = pd.DataFrame({"A": pd.Series([True, True], dtype=pd.BooleanDtype()), "B": pd.Series([1,2], dtype="Int8")}) >>> a.groupby("A").sum().dtypes B Int8 dtype: object >>> ``` But if I increase the values in "B" such that the sum can't fit in an Int8: ``` >>> a = pd.DataFrame({"A": pd.Series([True, True], dtype=pd.BooleanDtype()), "B": pd.Series([124,126], dtype="Int8")}) >>> a.groupby("A").sum().dtypes B Int64 dtype: object >>> ``` For the same input type (Int8), sum returns either an Int8 or an Int64 depending on the values in the original series. I think value dependent type behavior should be avoided, and in this example, sum(Int8) should always return Int64, irrespective of the values in the series. This would have more predictable behavior for downstream consumers of the aggregate column, and also, probably would improve the performance of the aggregate itself, if it had a pre-determined return type. ### Feature Description All aggregate should have a pre-determined return type for the given input type, and this behavior should not be affected by the values in the column. ### Alternative Solutions None. ### Additional Context _No response_
[ "Enhancement", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "I think there is already an issue about this, a little bit older though" ]
2,112,546,833
57,194
fix typo
closed
2024-02-01T13:40:54
2024-02-01T20:14:06
2024-02-01T17:32:42
https://github.com/pandas-dev/pandas/pull/57194
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57194
https://github.com/pandas-dev/pandas/pull/57194
mdeff
1
- [ ] 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.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks @mdeff " ]
2,112,219,935
57,193
BUG: fix bug in DataFrame.diff when dataframe has bool dtype and axis=1
closed
2024-02-01T11:04:52
2024-06-28T06:27:49
2024-06-17T16:24:03
https://github.com/pandas-dev/pandas/pull/57193
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57193
https://github.com/pandas-dev/pandas/pull/57193
yuanx749
2
supersede #53248 - [x] closes #52579 (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 [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.
[ "Bug", "DataFrame", "Transformations" ]
0
0
0
0
0
0
0
0
[ "@jbrockmendel @mroeschke gentle ping for review.", "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." ]
2,112,052,708
57,192
BUG: pandas 2.2.0 `DataFrame.groupby` regression when group labels of type `pd.Timestamp`
open
2024-02-01T09:52:11
2025-06-02T17:10:20
null
https://github.com/pandas-dev/pandas/issues/57192
true
null
null
maread99
3
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd assert pd.__version__ == "2.2.0" index = pd.date_range("2024-02-01", "2024-02-03", freq="8h", tz="UTC") # index # DatetimeIndex(['2024-02-01 00:00:00+00:00', '2024-02-01 08:00:00+00:00', # '2024-02-01 16:00:00+00:00', '2024-02-02 00:00:00+00:00', # '2024-02-02 08:00:00+00:00', '2024-02-02 16:00:00+00:00', # '2024-02-03 00:00:00+00:00'], # dtype='datetime64[ns, UTC]', freq='8h') df = pd.DataFrame([1] * len(index), index) def f(ts: pd.Timestamp) -> pd.Timestamp: """Group by date, i.e. as timezone naive timestamp.""" return ts.normalize().tz_convert(None) grouped = df.groupby(by=f) keys = list(grouped.groups.keys()) print(keys) # [Timestamp('2024-02-01 00:00:00+0000', tz='UTC'), # Timestamp('2024-02-02 00:00:00+0000', tz='UTC'), # Timestamp('2024-02-03 00:00:00+0000', tz='UTC')] ``` ### Issue Description Although the return from the 'by' function is timezone naive, the group labels are timezone aware (UTC). (I've tried every combination of the `as_index` and `group_keys` options, always get the same group keys). ### Expected Behavior Would have expected behaviour as pandas 2.1.4 and prior, i.e,. group keys as returned from the 'by' function... ```python import pandas as pd assert pd.__version__ == "2.1.4" index = pd.date_range("2024-02-01", "2024-02-03", freq="8h", tz="UTC") df = pd.DataFrame([1] * len(index), index) def f(ts: pd.Timestamp) -> pd.Timestamp: return ts.normalize().tz_convert(None) grouped = df.groupby(by=f) keys = list(grouped.groups.keys()) print(keys) ``` ``` [Timestamp('2024-02-01 00:00:00'), Timestamp('2024-02-02 00:00:00'), Timestamp('2024-02-03 00:00:00')] ``` ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.9.13.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22631 machine : AMD64 processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United Kingdom.1252 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.4 dateutil : 2.8.2 setuptools : 58.1.0 pip : 23.3.2 Cython : None pytest : 8.0.0 hypothesis : 6.97.3 sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.4 html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : 8.14.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : 2.9.0 odfpy : None openpyxl : None pandas_gbq : None pyarrow : 15.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : 3.9.2 tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "Regression", "Timezones", "Index" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Result of a git bisect:\r\n\r\n```\r\ncommit 746e5eee860b6e143c33c9b985e095dac2e42677\r\nAuthor: jbrockmendel\r\nDate: Mon Oct 16 11:50:28 2023 -0700\r\n\r\n ENH: EA._from_scalars (#53089)\r\n```\r\n\r\ncc @jbrockmendel ", "yah i think thats a problem in DTA._from_scalars. _from_scalars itself was a mistake xref #56430", "This can be reproduced just using `index.map`, so taking off the groupby label. " ]
2,111,600,616
57,191
ENH: deprecate reading from clipboard only supports utf-8 encoding
open
2024-02-01T05:41:04
2024-02-04T14:48:38
null
https://github.com/pandas-dev/pandas/issues/57191
true
null
null
PaleNeutron
1
### Feature Type - [ ] Adding new functionality to pandas - [X] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description Code following will raise `NotImplementedError: reading from clipboard only supports utf-8 encoding` ```python df = pd.read_clipboard(encoding="gbk") ``` BUT, if user do it with: ```python pd.io.clipboard.ENCODING = "gbk" df = pd.read_clipboard() pd.io.clipboard.ENCODING = "utf8" ``` It works well. ### Feature Description I am not sure why `encoding` in pandas is fixed to 'utf8', but in wsl2 user's windows system default encoding is usually not Unicode and very hard to migrate this settings. Allow user change encoding of `read_clipboard` will be very helpful. ### Alternative Solutions ```python pd.io.clipboard.ENCODING = "gbk" df = pd.read_clipboard() pd.io.clipboard.ENCODING = "utf8" ``` ### Additional Context data for testting: 这 | 1 -- | -- 是 | 2 一 | 3 个 | 4 表 | 5 ``` # stdout[:-2] data = b'\xd5\xe2\t1\r\n\xca\xc7\t2\r\n\xd2\xbb\t3\r\n\xb8\xf6\t4\r\n\xb1\xed\t5\r\n' ```
[ "Enhancement", "IO Data", "Needs Discussion" ]
0
0
0
0
0
0
0
0
[ "Thanks for the request. pandas implements this by vendoring [pyperclip](https://github.com/asweigart/pyperclip). It does not appear to me that pyperclip (explicitly) supports anything but UTF-8, I would be hesistant to support other encodings unless pyperclip supports them or there is extensive testing." ]
2,111,566,090
57,190
CI: Pinning doc previewer action to current release
closed
2024-02-01T05:07:12
2024-02-01T17:15:04
2024-02-01T17:14:56
https://github.com/pandas-dev/pandas/pull/57190
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57190
https://github.com/pandas-dev/pandas/pull/57190
datapythonista
1
I don't think we'll have any doc previewer release that won't be done for pandas, but pinning the action to avoid automatic upgrades anyway.
[ "Docs", "CI" ]
0
0
0
0
0
0
0
0
[ "Thanks for the follow up @datapythonista " ]
2,111,162,868
57,189
BUG: Series.map() coerces Int64Dtype and int64[pyarrow] series which contain missing values to float64
open
2024-01-31T23:26:59
2024-02-02T09:21:57
null
https://github.com/pandas-dev/pandas/issues/57189
true
null
null
weltenseglr
6
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [X] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd import pyarrow as pa ser1 = pd.Series([1,2,3,None,10], dtype=pd.Int64Dtype()) ser2 = pd.Series([1,2,3,pd.NA,10], dtype=pd.Int64Dtype()) ser3 = pd.Series([1,2,3,pd.NA,10], dtype=pd.ArrowDtype(pa.int64())) for ser in ser1, ser2, ser3: print(f"initial dtype: {ser.dtype}") ser_mapped = ser.map(lambda x: x) print(f"post map dtype: {ser_mapped.dtype}") ser_filtered = ser.dropna().map(lambda x: x) print(f"dropna map dtype: {ser_mapped.dtype}") ser2.map(type) ser2.dropna().map(type) """ output: for ser1: initial dtype: Int64 post map dtype: float64 dropna map dtype: float64 for ser2: initial dtype: Int64 post map dtype: float64 dropna map dtype: float64 for ser3: initial dtype: int64[pyarrow] post map dtype: float64 dropna map dtype: float64 """ ``` ### Issue Description Using map on a Series with dtype Int64Dtype or int64[dtype] will coerce values to float if it contains any missing values. ``` >>> ser2.map(type) 0 <class 'float'> 1 <class 'float'> 2 <class 'float'> 3 <class 'float'> 4 <class 'float'> dtype: object >>> ser2.dropna().map(type) 0 <class 'int'> 1 <class 'int'> 2 <class 'int'> 4 <class 'int'> dtype: object ``` ### Expected Behavior Series.map() should not coerce into float64 with these dtypes. As stated in the documentation on [working with missing data](https://pandas.pydata.org/docs/user_guide/missing_data.html#values-considered-missing): > [NA](https://pandas.pydata.org/docs/reference/api/pandas.NA.html#pandas.NA) for [StringDtype](https://pandas.pydata.org/docs/reference/api/pandas.StringDtype.html#pandas.StringDtype), [Int64Dtype](https://pandas.pydata.org/docs/reference/api/pandas.Int64Dtype.html#pandas.Int64Dtype) (and other bit widths), Float64Dtype`(and other bit widths), :class:`BooleanDtype and [ArrowDtype](https://pandas.pydata.org/docs/reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype). **These types will maintain the original data type of the data.** ### Installed Versions <details> >>> pd.show_versions() /usr/lib/python3.12/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") INSTALLED VERSIONS ------------------ commit : db11e25d2b1175fdf85d963a88ff5a1d4bdb6fd8 python : 3.12.1.final.0 python-bits : 64 OS : Linux OS-release : 6.6.13-200.fc39.x86_64 Version : #1 SMP PREEMPT_DYNAMIC Sat Jan 20 18:03:28 UTC 2024 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : en_IE.UTF-8 LOCALE : en_IE.UTF-8 pandas : 3.0.0.dev0+197.gdb11e25d2b numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 67.7.2 pip : 23.2.1 Cython : None pytest : 7.4.3 hypothesis : None sphinx : 7.2.6 blosc : None feather : None xlsxwriter : None lxml.etree : 5.0.0 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.19.0 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : 15.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "NA - MaskedArrays", "Arrow" ]
2
0
0
0
0
0
0
0
[ "take", "https://github.com/pandas-dev/pandas/issues/56606\r\n\r\nI had the same issue, based on the issue above, it seemed to be intentional change in 2.2.X", "@rohanjain101 Yeah you're right. I believe it changed from v2.1.x\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/a671b5a8bf5dd13fb19f0e88edc679bc9e15c673/pandas/core/arrays/base.py#L2188\r\n\r\nto \r\n\r\nhttps://github.com/pandas-dev/pandas/blob/c3014abb3bf2e15fa66d194ebd2867161527c497/pandas/core/arrays/masked.py#L1332-L1333\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/c3014abb3bf2e15fa66d194ebd2867161527c497/pandas/core/arrays/arrow/array.py#L1426-L1430\r\n \r\nin v2.2.0. Guess you might have to cast it back to your wanted dtype @weltenseglr ", "Thanks for your feedback, @rohanjain101 @remiBoudreau. I think the documentation is outdated then?\r\n[Series.map()](https://pandas.pydata.org/docs/reference/api/pandas.Series.map.html#pandas.Series.map) does not warn about this matter and [missing data](https://pandas.pydata.org/docs/user_guide/missing_data.html#values-considered-missing) states that\r\n> [NA](https://pandas.pydata.org/docs/reference/api/pandas.NA.html#pandas.NA) for [StringDtype](https://pandas.pydata.org/docs/reference/api/pandas.StringDtype.html#pandas.StringDtype), [Int64Dtype](https://pandas.pydata.org/docs/reference/api/pandas.Int64Dtype.html#pandas.Int64Dtype) (and other bit widths), Float64Dtype`(and other bit widths), :class:`BooleanDtype and [ArrowDtype](https://pandas.pydata.org/docs/reference/api/pandas.ArrowDtype.html#pandas.ArrowDtype). **These types will maintain the original data type of the data.**\r\n\r\nCasting back won't help in my case, as my mapper must not receive coerced values...\r\n\r\nI'm trying to figure out how to maintain the original data type. Any ideas?\r\n\r\n\r\n\r\n", "@weltenseglr You could use the workaround described in https://github.com/pandas-dev/pandas/issues/56606#issuecomment-1870453754\r\n\r\nUsing the python map operator instead of Series.map. Atleast for now, this preserves the original type.", "thanks, @rohanjain101.\r\n\r\nI guess I will have to implement a workaround based on your suggestion or revert to a 2.1 release.\r\nHowever, it still feels wrong that pandas' map casts nullable numerical dtypes to float64.\r\n\r\nIs this going to change in pandas 3.0? I think this doesn't play well with the project's intentions regarding PDEP-10 and its benefits?" ]
2,111,108,717
57,188
ENH: align timedelta fractional seconds
open
2024-01-31T22:42:03
2024-05-15T14:22:00
null
https://github.com/pandas-dev/pandas/issues/57188
true
null
null
wjandrea
7
### Feature Type - [X] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description It's hard to read a column of timedeltas with fractional seconds of different precisions because it's not aligned, for example: ``` 0 0 days 00:00:01 1 0 days 00:00:00.500000 2 0 days 00:00:00.333333333 dtype: timedelta64[ns] ``` It'd be easier to read like this: ``` 0 0 days 00:00:01 1 0 days 00:00:00.500000 2 0 days 00:00:00.333333333 dtype: timedelta64[ns] ``` or ``` 0 0 days 00:00:01.000000000 1 0 days 00:00:00.500000000 2 0 days 00:00:00.333333333 dtype: timedelta64[ns] ``` To reproduce: ```python s = 1 / pd.Series(np.arange(3)+1) td = pd.to_timedelta(s, unit='s') td ``` ### Feature Description Add padding on the right. In this case, it can be done by left-justifying to the largest size: ```python n = td.astype(str).apply(len).max() td.astype(str).str.ljust(n) ``` ``` 0 0 days 00:00:01 1 0 days 00:00:00.500000 2 0 days 00:00:00.333333333 dtype: object ``` But of course, this wouldn't work for different numbers of days. For example: ```python td1 = pd.concat([td, pd.Series(pd.Timedelta(days=4000))]) ``` ``` 0 0 days 00:00:01 1 0 days 00:00:00.500000 2 0 days 00:00:00.333333333 0 4000 days 00:00:00 dtype: object ``` If timedeltas had a `.replace()` method so you could zero out the days, then it would work, but AFAIK such a method doesn't exist. BTW, the same thing is already implemented for floats and datetimes. ```python >>> s*10 0 10.000000 1 5.000000 2 3.333333 dtype: float64 >>> pd.Timestamp(0) + td 0 1970-01-01 00:00:01.000000000 1 1970-01-01 00:00:00.500000000 2 1970-01-01 00:00:00.333333333 dtype: datetime64[ns] ``` ### Alternative Solutions n/a ### Additional Context _No response_
[ "Enhancement", "Output-Formatting", "Timedelta" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report - agreed this would be an improvement. PRs to fix are welcome.", "> PRs to fix are welcome.\r\n\r\nWorking on one :) but this functionality is buried in some Cython code (`_Timedelta._repr_base`), which I've never written before, so it's a bit of a slog.", "still working on this @wjandrea ?", "Hi @wjandrea , just a friendly follow-up on my previous comment. Since I haven't heard back, I wanted to let you know that I'm planning to start working on this soon. Your input would be valuable before I begin. Thanks!", "take", "take", "@mafaldam Yeah, I actually made quite a bit of progress on this, but it's setting up the build system that I'm stuck on right now. Let me plug away at it a little while and I'll let you know. Sorry for not replying sooner :)" ]
2,111,103,979
57,187
REF: Remove internals.base
closed
2024-01-31T22:37:28
2024-02-02T17:53:31
2024-02-02T17:53:31
https://github.com/pandas-dev/pandas/issues/57187
true
null
null
rhshadrach
0
Ref: https://github.com/pandas-dev/pandas/pull/57118#discussion_r1469860926
[ "Refactor", "Internals" ]
0
0
0
0
0
0
0
0
[]
2,111,037,661
57,186
DEPR: Enforce deprecation of groupby(..., axis=1)
closed
2024-01-31T21:55:30
2024-02-01T21:37:20
2024-02-01T17:39:51
https://github.com/pandas-dev/pandas/pull/57186
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57186
https://github.com/pandas-dev/pandas/pull/57186
rhshadrach
1
- [ ] 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. Enforcing #51203
[ "Groupby", "Deprecate" ]
0
0
0
0
0
0
0
0
[ "Thanks @rhshadrach " ]
2,111,026,264
57,185
CI: Fix generating requirements-dev.txt
closed
2024-01-31T21:47:11
2024-01-31T22:17:58
2024-01-31T22:10:02
https://github.com/pandas-dev/pandas/pull/57185
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57185
https://github.com/pandas-dev/pandas/pull/57185
rhshadrach
2
- [ ] 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. Fix for #56993
[ "Bug", "CI", "Dependencies" ]
0
0
0
0
0
0
0
0
[ "Docker build job pulls from main's requirements-dev.txt. It will fail until this is merged.", "Thanks @rhshadrach " ]
2,110,992,084
57,184
Use ruff to detect banned import
closed
2024-01-31T21:22:40
2024-03-17T07:53:18
2024-02-05T17:31:50
https://github.com/pandas-dev/pandas/pull/57184
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57184
https://github.com/pandas-dev/pandas/pull/57184
tqa236
1
There are several other potential replacement, I just open this PR first to check if this replacement is good or not. The newly added `noqa` in `pandas/io/common.py` shows that the check works. - [ ] 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.
[ "Code Style" ]
0
0
0
0
0
0
0
0
[ "Thanks @tqa236 " ]
2,110,877,862
57,183
BUG: df.reset_index(names=[None]) names index column NaN instead of None
closed
2024-01-31T20:06:36
2024-02-03T23:00:57
2024-02-03T23:00:57
https://github.com/pandas-dev/pandas/issues/57183
true
null
null
mvashishtha
1
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import pandas as pd df = pd.DataFrame([1]) result = df.reset_index(names=[None]) assert list(result.columns) == [None, 0], result.columns ``` ### Issue Description `reset_index(names=[None])` should add a column with name `None` containing the values of the index. Instead it adds a column with name `np.nan`. ### Expected Behavior This should be not raise an assertion: ```python import pandas as pd df = pd.DataFrame([1]) result = df.reset_index(names=[None]) assert list(result.columns) == [None, 0], result.columns ``` ### Installed Versions <details> ``` INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.9.18.final.0 python-bits : 64 OS : Darwin OS-release : 23.3.0 Version : Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.3.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : None IPython : 8.18.1 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None ``` </details>
[ "Dtype Conversions", "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "Hi, thanks for your report.\r\n\r\nInserting None into an Integer Index casts to float not to object, so this behavior is as expected" ]
2,110,869,914
57,182
Migrate pylint to ruff
closed
2024-01-31T20:03:19
2024-04-09T21:15:39
2024-04-08T21:24:19
https://github.com/pandas-dev/pandas/pull/57182
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57182
https://github.com/pandas-dev/pandas/pull/57182
tqa236
10
Hi @mroeschke, while looking into the `pylint` rule, I noticed that most of them are currently gated behind the `preview` flag. Do you think we should enable the `preview` flag or wait some rules to be promoted to stable in `ruff==0.2.0` (should be released in the next few weeks) Other than that, this PR is ready for review. - [ ] 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.
[ "Code Style" ]
0
0
0
0
0
0
0
0
[ "Is it possible to opt in to preview mode with just pylint?", "@mroeschke can you take a look at the latest commit and the 177 errors that it detects? I think we can achieve that with `pre-commit`, although we need to explicitly pass all necessary.\r\n\r\nThis new hook replaces the one below, which is disabled by default\r\n\r\n```\r\n- repo: https://github.com/pylint-dev/pylint\r\n rev: v3.0.1\r\n hooks:\r\n - id: pylint\r\n stages: [manual]\r\n args: [--load-plugins=pylint.extensions.redefined_loop_name]\r\n```\r\n\r\nGiven that I can't fix all the errors within 1 PR, let me know how should I proceed", "My main curiosity is how many of the 177 errors are ruff-pylint checks that are not enabled in the current pylint checks? https://github.com/pandas-dev/pandas/blob/cad0d87c63a914ebc6e33fb1b5e22c9068d75710/pyproject.toml#L369\r\n\r\nIdeally this PR should just bump ruff and enable ruff-pylint, and all modifications are updates from other rules.\r\n\r\nThen in a follow up PR, the old pylint can be removed (and optional ruff-pylint rules can be enabled too)", "hi @mroeschke, please take a look at the last commit, where I manage to make an automatic translation of `pylint` config to `ruff` config with the help of [`pylint-to-ruff`](https://github.com/akx/pylint-to-ruff).\r\n\r\nGiven the list of `pylint` rules that has not been implemented in `ruff` (the one that's commented out), let me know if it's ok to drop `pylint` in favor of `ruff`", "@mroeschke thanks for your review. I rebased on `main`", "hi @mroeschke, I wonder if we should split the version bump of `ruff` with the switch from `pylint` to `ruff` so that we can use the latest `ruff` version first. \r\n\r\nI can also take a look at the rather messy bump from `0.2.0` to `0.3.0` if it's good for you", "Yes I think that's a good idea to bump ruff to 0.3.0 first before doing a pylint migration", "Coming back around to this; to simplify the transition I think we can just enable the pylint rule in ruff (and ignore the non-fix rules that don't pass currently) and remove the pylint config in pre-commit-config. I think it's OK to not exactly have a 1:1 transition between the old and new pylint configuration", "Thanks @tqa236 ", "thank you for finalizing this PR, I was on vacation and didn't have time to check your last message." ]
2,110,729,553
57,181
ENH: Add a functionality to scan csv files and show some useful info (eg-the record count) of a CSV file without loading entire file.
closed
2024-01-31T18:36:43
2024-02-01T00:43:27
2024-02-01T00:43:27
https://github.com/pandas-dev/pandas/issues/57181
true
null
null
KelumPerera
3
### Feature Type - [X] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description There are many instances where users want to know how many records are in their large CSV files before loading them. Good if pandas have some functionality to scan CSV files (without reading the entire file to memory at once), and provide some useful information to the user. -Number of records in the file by counting new lines -What are the column names -What is the delimiter -Are there non-standard characters within the data, Show them to decide suitable encoding method -What is the optimal record chunk size when reading the file using pandas -Memory requirement to hold the entire file in memory and memory requirement to hold data in each column ### Feature Description # Sample code to show number of rows by using Numpy library, #copied from https://stackoverflow.com/a/64744699 import numpy as np chunk = 1024 * 1024 * 512 # Process 500 MB at a time. f = np.memmap(r"C:\path\to\csvfile\somefile.csv") num_newlines = sum(np.sum(f[i:i+chunk] == ord('\n')) for i in range(0, len(f), chunk)) del f print(num_newlines) ### Alternative Solutions It is hard to find alternative solutions especially when the file size is 10+ gigabytes ### Additional Context _No response_
[ "Enhancement", "IO CSV", "Needs Discussion" ]
0
0
0
0
0
0
0
0
[ "Thanks for the request. This indeed seems useful to me, but outside the scope of pandas.", "@KelumPerera take a look at the csv package, especially [Sniffer](https://docs.python.org/3/library/csv.html#csv.Sniffer) and [chardet](https://chardet.readthedocs.io/en/latest/usage.html) for charset detection.", "Agreed I think this is outside the scope of pandas. I would recommend using the standard library `csv` module as described above as a starting point. Closing as out of scope" ]
2,110,701,228
57,180
Backport PR #57169 on branch 2.2.x (REGR: DataFrame.sort_index not producing stable sort)
closed
2024-01-31T18:20:19
2024-01-31T19:20:42
2024-01-31T19:20:42
https://github.com/pandas-dev/pandas/pull/57180
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57180
https://github.com/pandas-dev/pandas/pull/57180
meeseeksmachine
0
Backport PR #57169: REGR: DataFrame.sort_index not producing stable sort
[ "Regression", "Index" ]
0
0
0
0
0
0
0
0
[]
2,110,677,561
57,179
Backport PR #57175 on branch 2.2.x (BUG: Interchange protocol implementation handles empty dataframes incorrectly)
closed
2024-01-31T18:05:45
2024-01-31T19:06:36
2024-01-31T19:06:36
https://github.com/pandas-dev/pandas/pull/57179
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57179
https://github.com/pandas-dev/pandas/pull/57179
meeseeksmachine
0
Backport PR #57175: BUG: Interchange protocol implementation handles empty dataframes incorrectly
[ "Interchange" ]
0
0
0
0
0
0
0
0
[]
2,110,602,795
57,178
ENH: Not silently ignore violation of minimal required version of SQLAlchemy
open
2024-01-31T17:21:53
2024-03-19T08:32:58
null
https://github.com/pandas-dev/pandas/issues/57178
true
null
null
bebach
5
### Feature Type - [ ] Adding new functionality to pandas - [X] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description #### Observation After upgrading to Pandas 2.2.0 calling `read_sql_query` with a SQLAlchemy query on an SQLAlchemy connection yielded `"Query must be a string unless using sqlalchemy."` without any indication why or what may have broken with the upgrade. #### Analysis Tracking the problem down it was found that `pandasSQL_builder` [(code)](https://github.com/pandas-dev/pandas/blob/f538741432edf55c6b9fb5d0d496d2dd1d7c2457/pandas/io/sql.py#L900) calls `sqlalchemy = import_optional_dependency("sqlalchemy", errors="ignore")` to resolve the optional SQLAlchemy package (which was installed in my case) Due to `errors="ignore"` the violation of the minimal required version for SQLAlchemy does not lead to a warn or raise [(code)](https://github.com/pandas-dev/pandas/blob/f538741432edf55c6b9fb5d0d496d2dd1d7c2457/pandas/compat/_optional.py#L156) but just silently returns with `None`. This in turn lets `pandasSQL_builder` silently default to `SQLiteDatabase(con)`. ### Feature Description #### Proposed improvement Do not ignore the minimal version violation in `import_optional_dependency` in this context but make it obvious. For example by introducing an additional "errors"-mode like `import_optional_dependency("sqlalchemy", errors="raise-on-version-violation")`. ### Alternative Solutions ./. ### Additional Context _No response_
[ "Enhancement", "IO SQL", "Dependencies" ]
1
0
0
0
0
0
0
0
[ "Thanks for the report! It looks like this was changed in #45679 to allow for other dependencies. Perhaps the logic could be changed there so that when SQLAlchemy is used, we do check that the version is satisfied.\r\n\r\nFurther investigations and PRs to fix are welcome!", "I have attempted to recreate the issue in a fresh environment with `pandas==2.2.0; sqlalchemy==2.0.25`, and the output seems to be correct. I may require assistance in reproducing the issue.\r\n\r\n```python\r\nfrom sqlalchemy import create_engine\r\nimport pandas as pd\r\n\r\nengine = create_engine(\"sqlite:///:memory:\")\r\n\r\ndf = pd.DataFrame({\r\n \"id\": [1, 2, 3],\r\n \"name\": [\"Alice\", \"Bob\", \"Charlie\"]\r\n})\r\ndf.to_sql(\"Person\", engine, index=False)\r\n\r\nsql_query = \"SELECT * FROM Person\"\r\nresult = pd.read_sql_query(sql_query, engine)\r\nprint(result)\r\n```\r\n```\r\n id name\r\n0 1 Alice\r\n1 2 Bob\r\n2 3 Charlie\r\n```\r\n", "The issue is not that it works with SQLAlchemy 2 but that it gives no clue why it does not work with SQLAlchemy < 2.x\r\n\r\nTo replicate install SQLAlchemy==1.4 and rerun the code-snippet from above. This results in..\r\n\r\n```\r\n$ python pandas_test.py\r\nD:\\temp\\pandas-issue-57178\\pandas_test.py:10: UserWarning: pandas only supports SQLAlchemy connectable (engine/connection) or database string URI or sqlite3 DBAPI2 connection. Other DBAPI2 objects are not tested. Please consider using SQLAlchemy.\r\n df.to_sql(\"Person\", engine, index=False)\r\nTraceback (most recent call last):\r\n File \"D:\\temp\\pandas-issue-57178\\pandas_test.py\", line 10, in <module>\r\n df.to_sql(\"Person\", engine, index=False)\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\util\\_decorators.py\", line 333, in wrapper\r\n return func(*args, **kwargs)\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\core\\generic.py\", line 3081, in to_sql\r\n return sql.to_sql(\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\io\\sql.py\", line 842, in to_sql\r\n return pandas_sql.to_sql(\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\io\\sql.py\", line 2851, in to_sql\r\n table.create()\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\io\\sql.py\", line 984, in create\r\n if self.exists():\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\io\\sql.py\", line 970, in exists\r\n return self.pd_sql.has_table(self.name, self.schema)\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\io\\sql.py\", line 2866, in has_table\r\n return len(self.execute(query, [name]).fetchall()) > 0\r\n File \"D:\\temp\\pandas-issue-57178\\venv\\lib\\site-packages\\pandas\\io\\sql.py\", line 2673, in execute\r\n cur = self.con.cursor()\r\nAttributeError: 'Engine' object has no attribute 'cursor'\r\n\r\n```\r\n\r\nwhich is surprising given that we just created the engine with SQLAlchemy. And it gives the user no clue that this is due to violation of version requirement.\r\n\r\nIt would be obvious what is the issue if the version check in `import_optional_dependency` raises the\r\n\r\n```\r\n msg = (\r\n f\"Pandas requires version '{minimum_version}' or newer of '{parent}' \"\r\n f\"(version '{version}' currently installed).\"\r\n )\r\n```\r\nhttps://github.com/pandas-dev/pandas/blob/f538741432edf55c6b9fb5d0d496d2dd1d7c2457/pandas/compat/_optional.py#L152\r\n\r\n... instead of just silently returning None (which only later leads to the miss-leading error from above.)\r\n", "Seems related #57049, whether to support Sqlalchemy 1.4 is under discussion.", "I think this is related. It should state that sqlalchemy <2.0 is not supported instead of \"not installed\".\r\n\r\n```python\r\nimport sqlalchemy\r\nprint(\"sqlalchemy Version:\", sqlalchemy.__version__)\r\npd.read_sql(\"select * from osm_point limit 1\", connection_string)\r\n```\r\n```sh\r\nsqlalchemy Version: 1.4.52\r\n...\r\nImportError: Using URI string without sqlalchemy installed.\r\n```" ]
2,110,496,397
57,177
ENH: Expose integer formatting also for default display, not only styler
open
2024-01-31T16:29:42
2024-02-15T05:16:52
null
https://github.com/pandas-dev/pandas/issues/57177
true
null
null
enryH
14
### Feature Type - [X] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description I noticed that in Pandas version `2.2` the internal implementation of `IntArrayFormatter` was changed (or at least renamed), marking the classes as private using one underscore. I used the implementation as described [here](https://stackoverflow.com/a/29663750/9684872) to format integers in a DataFrame on each display. See changes between `2.1` and `2.2` to make the linked patch work: [link](https://github.com/RasmussenLab/njab/pull/4/commits/10b0c84ddb28a1dd9c2bd58e9b6af148dbd6c9dc) I see that the styler supports formatting thousands: ```python import pandas as pd pd.options.styler.format.thousands = ',' s = pd.Series([1_000_000]).to_frame() s.style # does change display of s to 1,000,000 ``` however ``` s # will display 1000000 ``` Would it be possible to add the same to the display options? ### Feature Description pd.options.format.thousands = ',' would need to pass: ```python if pd.options.format.thousands: format_str = f':{pd.options.format.thousands}d'.format else: format_str = ':d'.format ``` ### Alternative Solutions Change the default [here](https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/format.py#L1475) ```python class IntArrayFormatter(pf._GenericArrayFormatter): def _format_strings(self): formatter = self.formatter or '{:,d}'.format fmt_values = [formatter(x) for x in self.values] return fmt_values pf._IntArrayFormatter = IntArrayFormatter ``` Using the above patch I get the display I would prefer: ``` >>> pd.Series([1_000_000]) 0 1,000,000 dtype: int64 ``` ### Additional Context Working with large integers in tables is made easier if thousands are visually distinguished. Maybe there is already a way to specify that formatter function (`str.format`) for display, which would be perfect.
[ "Enhancement", "Output-Formatting" ]
0
0
0
0
0
0
0
0
[ "Thanks for the request. From your example:\r\n\r\n> s.style # does not change display of s\r\n\r\nI'm seeing that this does display the comma separator, are you not? Or perhaps you meant that `s` without `.style` still does not show the commas?", "i dont think this feature is about Styler. It is about adding functionality to the default DataFrame display that is demonstrated by Styler, i.e. which Styler already possesses.", "Yes exactly, currently I have to use the internals to make `s` already represent with the commas. \r\n\r\n```python\r\n>>> import pandas as pd\r\n>>> pd.options.styler.format.thousands = ',' # here it would be great to have the option pd.options.display.thousands \r\n>>> s = pd.Series([1_000_000])\r\n\r\n>>> s\r\n0 1000000\r\ndtype: int64\r\n>>>s.to_frame().style\r\n 0\r\n0\t1,000,000\r\n```\r\n\r\nI see that I put a \"not\" at the wrong place intially... Sorry about that. I'll clarify my example above by modifying it.", "I would personally find this feature convenient, I'm positive on it. @attack68 do you have any thoughts?\r\n\r\nIf we do implement this, I think it should only be implemented for integer/float dtypes, and documented as such. Users should not expect pandas to infer whether to insert commas in object dtype values.", "Hello @enryH,\r\n\r\nMy project team is looking for Pandas enhancement features for our grad school semester long project. We saw this task and would like to contribute if possible!", "i think its generally quite handy to have configurable options for precision, thousands and decimal separator. Styler avoided using the locale package, if I recall correctly, but it was a bit tricky in the end to make sure the european decimal-comma was compatible with the us comma-decimal style. \r\n\r\nTo make it easier this should definitely only be applied to float/int dtypes.", "i think its generally quite handy to have configurable options for precision, thousands and decimal separator. Styler avoided using the locale package, if I recall correctly, but it was a bit tricky in the end to make sure the european decimal-comma was compatible with the us comma-decimal style. \r\n\r\nTo make it easier this should definitely only be applied to float/int dtypes.", "take", "I guess it will boil down to figuring out how the formatting function is set (see `IntArrayFormatter` [here](https://github.com/pandas-dev/pandas/blob/main/pandas/io/formats/format.py#L1475)):\r\n\r\n```python\r\nformatter = self.formatter or '{:d}'.format # how to set self.formatter from pandas.options\r\n```", "I ran into the same problem too (down to relying on the same StackOverflow code to modify display of integers). I also would like a cleaner way to do it.\r\n\r\nAdditionally, what is the recommended way to to handle the name change? I have some tools that need to support both `pd.io.formats.format.IntArrayFormatter` and `pd.io.formats.format._IntArrayFormatter`. Thank you.", "> I ran into the same problem too (down to relying on the same StackOverflow code to modify display of integers). I also would like a cleaner way to do it.\r\n\r\nPRs welcome!\r\n\r\n> Additionally, what is the recommended way to to handle the name change? I have some tools that need to support both `pd.io.formats.format.IntArrayFormatter` and `pd.io.formats.format._IntArrayFormatter`. Thank you.\r\n\r\nIntArrayFormatter is not intended to be public. If you have a need to use it, can you open a new issue detailing it.\r\n\r\n", "Hey @rhshadrach is the goal to create a new class or to improve the _IntArrayFormatter class and change it back to public? \r\n\r\nJust wanted to understand what was considered in scope before tackling this issue. \r\n\r\nIf this is not the right forum/area to ask questions, please let know!", "> IntArrayFormatter is not intended to be public. If you have a need to use it, can you open a new issue detailing it.\r\n\r\nMaybe it's easier to talk about what I am trying to do in order to avoid an XY problem. What I need is a way to automatically always show commas in integers. As `IntArrayFormatter` is not intended to be public, I'd be happy to use any different method to accomplish the same goal.\r\n", "Thanks @saiwing-yeung - we're open for PRs to add an option (e.g. `pd.set_option(\"display.numeric_separator\")` - could probably use a better name!). It would default to `''`, but users could change to e.g. `'_'` or `','`.\r\n\r\n@Meadiocre \r\n\r\n> is the goal to create a new class or to improve the _IntArrayFormatter class and change it back to public?\r\n\r\nNo - just expose a new option for users." ]
2,110,257,577
57,176
BUG: pandas.core.groupby.SeriesGroupBy.idxmax (and idxmin) - unexpected behavior with groups containing single NaN value
closed
2024-01-31T14:44:23
2024-02-01T20:42:52
2024-01-31T22:47:12
https://github.com/pandas-dev/pandas/issues/57176
true
null
null
semyonbok
4
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this bug exists on the [main branch](https://pandas.pydata.org/docs/dev/getting_started/install.html#installing-the-development-version-of-pandas) of pandas. ### Reproducible Example ```python import numpy as np import pandas as pd df = pd.DataFrame({ "var": ["A", "B", "C", "C", "D", "D"], "val": [11, np.nan, 12, 13, 14, np.nan] }) df.groupby("var")["val"].idxmax() ``` ### Issue Description The provided code snippet yields the following output: ```python var A 0 B 0 C 3 D 4 Name: val, dtype: int64 ``` Group 'B' with single `np.nan` value yields 0, which corresponds to the index of the first entry in the frame, relating to group "A". ### Expected Behavior The output with pandas 2.1.0 ```python var A 0.0 B NaN C 3.0 D 4.0 Name: val, dtype: float64 ``` ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.9.16.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 140 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United Kingdom.1252 pandas : 2.2.0 numpy : 1.26.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.3.2 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.1.9 lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.3 IPython : 8.18.1 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.8.2 numba : None numexpr : None odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.12.0 sqlalchemy : None tables : 3.9.2 tabulate : None xarray : None xlrd : 2.0.1 zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "Groupby", "Regression", "Duplicate Report", "Reduction Operations" ]
0
0
0
0
0
0
0
0
[ "I'm unable to produce regardless of version on Ubuntu 22.04.3 LTS and Docker container", "@remiBoudreau, thank you for giving it a try. I can add that I use Miniconda package manager; and I installed the latest pandas through conda-forge channel. I've just tried it on another Windows machine, and observed the same behaviour. Furthermore, groups with single `np.nan` are not just zeroed-out, but assigned with the first object from the index in my case.\r\n```python\r\nimport numpy as np\r\nimport pandas as pd\r\n\r\ndf = pd.DataFrame({\r\n \"var\": [\"A\", \"B\", \"C\", \"C\", \"D\", \"D\", \"E\"],\r\n \"val\": [11, np.nan, 12, 13, 14, np.nan, np.nan]\r\n}, index=list(\"abcdefg\"))\r\n\r\ndf.groupby(\"var\")[\"val\"].idxmax()\r\n```\r\noutputs:\r\n```python\r\nvar\r\nA a\r\nB a\r\nC d\r\nD e\r\nE a\r\nName: val, dtype: object\r\n```\r\nFinally, I see that [`_idxmax_idxmin`](https://github.com/pandas-dev/pandas/blob/bc09d5765197c39daae8326fc9ee44bb2c3153c4/pandas/core/groupby/groupby.py#L5792C9-L5792C23) logic is quite new. Please let me know if there anything useful I can provide from my end. ", "Thanks for the report. This was fixed in #57046 and has the same root cause. The fix will be part of 2.2.1.", "@rhshadrach, great news, thank you very much! I'll do my best to try the main branch prior to raising an issue next time :)" ]
2,110,228,091
57,175
BUG: Interchange protocol implementation handles empty dataframes incorrectly
closed
2024-01-31T14:31:00
2024-01-31T18:05:22
2024-01-31T18:05:14
https://github.com/pandas-dev/pandas/pull/57175
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57175
https://github.com/pandas-dev/pandas/pull/57175
MarcoGorelli
1
- [ ] closes #56700 (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.
[ "Interchange" ]
0
0
0
0
0
0
0
0
[ "Thanks @MarcoGorelli " ]
2,110,209,791
57,174
BUG: Interchange protocol implementation allows non-string column names
closed
2024-01-31T14:22:15
2024-02-02T01:26:35
2024-02-02T01:25:43
https://github.com/pandas-dev/pandas/pull/57174
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57174
https://github.com/pandas-dev/pandas/pull/57174
MarcoGorelli
1
- [ ] closes #56701 (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.
[ "Interchange" ]
0
0
0
0
0
0
0
0
[ "Thanks @MarcoGorelli " ]
2,110,169,168
57,173
BUG: pandas int extension dtypes has no attribute byteorder
closed
2024-01-31T14:04:12
2024-03-01T13:54:29
2024-02-01T19:04:29
https://github.com/pandas-dev/pandas/pull/57173
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57173
https://github.com/pandas-dev/pandas/pull/57173
MarcoGorelli
2
- [ ] closes #55069 (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.
[ "NA - MaskedArrays", "Interchange" ]
0
0
0
0
0
0
0
0
[]