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,140,212,859
57,472
BUG: Styler puts label before caption in to_latex()
closed
2024-02-17T15:51:31
2024-02-18T10:56:31
2024-02-18T10:52:13
https://github.com/pandas-dev/pandas/issues/57472
true
null
null
bileamScheuvens
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. - [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 pd.DataFrame().to_latex(caption="table", label="tab:1") ``` ### Issue Description Inside a float environment a label before a caption refs to the current section nr, not the figure nr displayed in the caption. This is rarely desirable and shouldn't be the only behavior. ### Expected Behavior Either these should be swapped: ```Python # pandas/io/formats/style.py:1178-1185 if label: obj.set_table_styles( [{"selector": "label", "props": f":{{{label.replace(':', '§')}}}"}], overwrite=False) if caption: obj.set_caption(caption) ``` or there should be an option for the order imo. ### Installed Versions <details> commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.10.8.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22631 machine : AMD64 processor : Intel64 Family 6 Model 183 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : de_DE.cp1252 pandas : 2.2.0 numpy : 1.26.2 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.1.2 Cython : None pytest : 8.0.0 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 5.0.1 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 : 2023.12.2 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 : 1.11.4 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Styler", "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "This isn't true. The label is placed after the caption command in both table and long tables.\r\n\r\n```python\r\ndf = pd.DataFrame([[1,2],[3,4]])\r\nprint(df.to_latex(label=\"table:1\", caption=\"Caption\"))\r\n\r\n###\r\n\\begin{table}\r\n\\caption{Caption}\r\n\\label{table:1}\r\n\\begin{tabular}{lrr}\r\n\\toprule\r\n & 0 & 1 \\\\\r\n\\midrule\r\n0 & 1 & 2 \\\\\r\n1 & 3 & 4 \\\\\r\n\\bottomrule\r\n\\end{tabular}\r\n\\end{table}\r\n###\r\n```", "Embarassing, Artifact of my hacky post processing workflow, not a pandas issue. \r\nSorry" ]
2,140,109,143
57,471
BUG: guess_datetime_format fails to infer timeformat
closed
2024-02-17T13:52:51
2024-02-22T04:06:48
2024-02-21T19:14:10
https://github.com/pandas-dev/pandas/pull/57471
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57471
https://github.com/pandas-dev/pandas/pull/57471
yuanx749
2
- [x] closes #57452(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.
[ "Datetime" ]
0
0
0
0
0
0
0
0
[ "Explanation of the fix:\r\n\r\nThe previous code below failed for date time str of the kind like \"2023-11-09T20:23:46\".\r\n\r\nIn L1006, `parsed_formatted` is parsed to the same \"2023\" for both \"%H%M\" and \"%Y\", then in L1010 format_guess[0] becomes \"%H%M\", rather than the correct \"%Y\". Noticing the order in `datetime_attrs_to_format`, I thus move \"%Y\" before \"%H%M\" to fix the bug.\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/63dc0f76faa208450b8aaa57246029fcf94d015b/pandas/_libs/tslibs/parsing.pyx#L996-L1013", "it's been a while since I looked at this function :) taking a look today, thanks for the fix" ]
2,140,020,022
57,470
BUG: style.apply applies the style in subset, but it also reset the style elsewhere.
closed
2024-02-17T12:09:34
2024-02-17T17:50:37
2024-02-17T17:47:50
https://github.com/pandas-dev/pandas/issues/57470
true
null
null
xgnata
9
### 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 import numpy as np def highlight_max(x, color): return np.where(x == np.nanmax(x.to_numpy()), f"color: {color};", None) df = pd.DataFrame(np.random.randn(5, 2), columns=["A", "B"]) df.style.apply(highlight_max, color='green', subset="A") df.style.apply(highlight_max, color='red', subset="B") ``` ### Issue Description style.apply has a "subset" parameter. The documentation is not very explicit, but one expect that style.apply applies the style on the specified subset leaving the other cells style unchanged. This is not the case. style.apply applies the style on the specified subset, but it also reset the style elsewhere in the dataframe. ### Expected Behavior One value in green in column A and one value in red in column B (in a jupyter notebook) It should be possible to apply a style on a subset, and then another style on another subset without losing the first styling. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.6.final.0 python-bits : 64 OS : Linux OS-release : 6.5.0-17-generic Version : #17-Ubuntu SMP PREEMPT_DYNAMIC Thu Jan 11 14:01:59 UTC 2024 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.26.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 68.1.2 pip : 23.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 : 3.1.3 IPython : 8.21.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 : None odfpy : None openpyxl : 3.1.2 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 : None xarray : None xlrd : None zstandard : None tzdata : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "Styler" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report, confirmed on main. Further investigations and PRs to fix are welcome.\r\n\r\ncc @attack68 ", "Hello I would be glad to work on it and fix it, \r\nSolution would be to add the inplace=True parameter so that we can easily use it in jupyter.\r\nWould be glad if anyone can also suggest other possible solutions\r\n", "take", "This isn't a bug at all.\r\n\r\nEvery time you access `pandas.DataFrame.style` it produces a new `Styler` object. You take the output of your first access and use that from there. \r\n\r\n@attack68 ", "The documentation clearly says returns a `Styler` object. \r\n\r\nhttps://pandas.pydata.org/docs/reference/api/pandas.DataFrame.style.html", "I am in the process of adding the in-place parameter to this, whilst it may not be a bug to be fixed, surely this could work as an additional feature?\r\n(I am a beginner so would be glad to receive any advice)", "@Delengowski : You are right. \r\nI was confused by this page in the documentation\r\nhttps://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.apply.html\r\nOK, it clearly says that it returns a Styler, but maybe one example like that could be added:\r\n\r\ndef highlight_max(x, color):\r\n return np.where(x == np.nanmax(x.to_numpy()), f\"color: {color};\", None)\r\ndf = pd.DataFrame(np.random.randn(5, 2), columns=[\"A\", \"B\"])\r\ntmp = df.style.apply(highlight_max, color='green', subset=\"A\")\r\ntmp.apply(highlight_max, color='red', subset=\"B\")\r\n\r\nI'm still a bit confused by the API. I know it won't be changed, but it is not unnatural to think that df.style.apply should modify the style property of the dataframe.", "There is an entire guide for the Styler. Its design has been carefully put together and results in a very advanced manipulator that is decoupled from a DataFrame. What might seem unnatural now will seem natural, and more powerful later. ", "Thanks! I missed that the methods were not being chained. 🤦 " ]
2,139,979,734
57,469
DEPR: to_pytimedelta return Index[object]
closed
2024-02-17T11:22:27
2024-03-20T17:30:29
2024-03-20T17:30:28
https://github.com/pandas-dev/pandas/pull/57469
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57469
https://github.com/pandas-dev/pandas/pull/57469
lamdang2k
2
- [x] closes #57463 - [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature - [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). - [x] Added an entry in the latest `doc/source/whatsnew/v3.0.0.rst` file
[]
0
0
0
0
0
0
0
0
[ "pre-commit.ci autofix", "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,139,913,602
57,468
Pandas Plot Fails to Open w/ Method Error
closed
2024-02-17T09:20:44
2024-06-23T18:05:14
2024-02-19T02:55:24
https://github.com/pandas-dev/pandas/issues/57468
true
null
null
christopher-silvey
7
### 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 backtesting import Backtest, Strategy from backtesting.lib import crossover # Artificial DataFrame creation data = { 'datetime': pd.date_range(start='2021-03-11', periods=7, freq='H'), 'open': [0.3871, 0.336, 0.3416, 0.34, 0.339, 0.4696, 0.4609], 'high': [0.3872, 0.349, 0.3576, 0.3478, 0.59, 0.496, 0.476], 'low': [0.314, 0.3352, 0.34, 0.3376, 0.3386, 0.4056, 0.4074], 'close': [0.3352, 0.3416, 0.34, 0.339, 0.4667, 0.4609, 0.4243], 'volume': [38135576.5, 8590583.9, 11334792.4, 4362490.6, 78260624.4, 52249994.4, 33508243.7] } df = pd.DataFrame(data).set_index('datetime') # Minimal Strategy Implementation class MinimalStrategy(Strategy): def init(self): pass def next(self): if not self.position: self.buy() # Backtest Setup bt = Backtest(df, MinimalStrategy, cash=1_000, commission=.002) # Run the backtest output = bt.run() print(output) # Plot the results bt.plot() ``` ### Issue Description Traceback (most recent call last): File "/Users/hidden/Development/Crypto/Bots/BootCamp/Algo/My_Backtesting/sma_backtest_v1.py", line 60, in <module> bt.plot() File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/backtesting/backtesting.py", line 1592, in plot return plot( File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/backtesting/_plotting.py", line 203, in plot df, indicators, equity_data, trades = _maybe_resample_data( File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/backtesting/_plotting.py", line 153, in _maybe_resample_data trades = trades.assign(count=1).resample(freq, on='ExitTime', label='right').agg(dict( File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/resample.py", line 352, in aggregate result = ResamplerWindowApply(self, func, args=args, kwargs=kwargs).agg() File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/apply.py", line 190, in agg return self.agg_dict_like() File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/apply.py", line 423, in agg_dict_like return self.agg_or_apply_dict_like(op_name="agg") File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/apply.py", line 1608, in agg_or_apply_dict_like result_index, result_data = self.compute_dict_like( File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/apply.py", line 496, in compute_dict_like results = [ File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/apply.py", line 497, in <listcomp> getattr(obj._gotitem(key, ndim=1), op_name)(how, **kwargs) File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/groupby/generic.py", line 294, in aggregate return self._python_agg_general(func, *args, **kwargs) File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/groupby/generic.py", line 327, in _python_agg_general result = self._grouper.agg_series(obj, f) File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/groupby/ops.py", line 863, in agg_series result = self._aggregate_series_pure_python(obj, func) File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/groupby/ops.py", line 884, in _aggregate_series_pure_python res = func(group) File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/pandas/core/groupby/generic.py", line 324, in <lambda> f = lambda x: func(x, *args, **kwargs) File "/Users/hidden/anaconda3/envs/BootCamp_AlgoTrading/lib/python3.10/site-packages/backtesting/_plotting.py", line 148, in f new_bar_idx = new_index.get_loc(mean_time, method='nearest') TypeError: Index.get_loc() got an unexpected keyword argument 'method' ### Expected Behavior It fails to open the graph in a new window. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.10.13.final.0 python-bits : 64 OS : Darwin OS-release : 22.4.0 Version : Darwin Kernel Version 22.4.0: Mon Mar 6 20:59:58 PST 2023; root:xnu-8796.101.5~3/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.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.1.0 pip : 24.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 5.1.0 html5lib : 1.1 pymysql : None psycopg2 : None jinja2 : 3.1.3 IPython : None 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 : 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 : None xarray : None xlrd : None zstandard : None tzdata : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "Needs Info" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. If you think this is a pandas bug, can you provide a minimal reproducible example. In particular, remove any dependency on third party packages as much as possible.", "Also, can you give this issue a meaningful title? Currently it is `BUG:`.", "@rhshadrach No problem at all. I have updated the title, sorry for overlooking that. I'll post some meaningful code here later today so you can reproduce the issue.\r\n\r\nThank you!", "@rhshadrach,\r\n\r\nI figured it out. I'm not sure if it is a bug or not or if it was designed this way. In my csv file, I did not have an index column. I was running this:\r\n\r\n`data = pd.read_csv('/path/to/my.csv', index_col=0, parse_dates=True)`\r\n\r\nHowever, when I tried setting index_col to False and specifying which column to get the parse_dates from the error went away:\r\n\r\n`data = pd.read_csv('/path/to/my.csv', index_col=False, parse_dates=['datetime'])`\r\n\r\nNow my graph popped up in a new window. Is this a bug? Couldn't Panda account for this mistake if the index column is missing?", "The error you're encountering is due to a compatibility issue between the `pandas` library and the `backtesting` library. The `backtesting` library might not be fully compatible with the version of `pandas` you are using, leading to the `TypeError` you mentioned.", "Thanks for the details @magentoman2009 \r\n\r\n> Is this a bug? Couldn't Panda account for this mistake if the index column is missing?\r\n\r\nNo - pandas can not detect what should be an index and what should not be from the CSV format. E.g.\r\n\r\n```\r\ndf = pd.DataFrame({\"a\": [1, 1, 2], \"b\": [3, 4, 5]})\r\ndf.to_csv(\"test.csv\", index=False)\r\n\r\nprint(pd.read_csv(\"test.csv\"))\r\n# a b\r\n# 0 1 3\r\n# 1 1 4\r\n# 2 2 5\r\n\r\nprint(pd.read_csv(\"test.csv\", index_col=0))\r\n# b\r\n# a \r\n# 1 3\r\n# 1 4\r\n# 2 5\r\n```\r\n\r\nClosing.\r\n", "I am having this problem too. Are you saying that the fix is not to have an index on your dataframe? " ]
2,139,718,597
57,467
PERF: RangeIndex.append returns a RangeIndex when possible
closed
2024-02-17T01:16:24
2024-03-06T21:15:55
2024-03-06T21:15:52
https://github.com/pandas-dev/pandas/pull/57467
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57467
https://github.com/pandas-dev/pandas/pull/57467
mroeschke
1
Discovered in https://github.com/pandas-dev/pandas/pull/57441
[ "Index" ]
0
0
0
0
0
0
0
0
[ "This looks good, do you want to fix the conflict here @mroeschke " ]
2,139,715,460
57,466
Backport PR #57311 on branch 2.2.x (Fixing multi method for to_sql for non-oracle databases)
closed
2024-02-17T01:10:25
2024-02-17T22:33:12
2024-02-17T22:33:12
https://github.com/pandas-dev/pandas/pull/57466
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57466
https://github.com/pandas-dev/pandas/pull/57466
meeseeksmachine
0
Backport PR #57311: Fixing multi method for to_sql for non-oracle databases
[ "Regression", "IO SQL" ]
0
0
0
0
0
0
0
0
[]
2,139,644,190
57,465
PERF: Return RangeIndex columns in str.extract when possible
closed
2024-02-16T23:50:06
2024-02-19T23:55:19
2024-02-19T23:55:15
https://github.com/pandas-dev/pandas/pull/57465
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57465
https://github.com/pandas-dev/pandas/pull/57465
mroeschke
1
Discovered in https://github.com/pandas-dev/pandas/pull/57441
[ "Performance", "Strings" ]
0
0
0
0
0
0
0
0
[ "Actually I don't know if this is easily generalizable so closing" ]
2,139,580,647
57,464
DOC: Making pandas always lowercase
closed
2024-02-16T22:35:14
2024-02-17T11:15:12
2024-02-17T01:10:50
https://github.com/pandas-dev/pandas/pull/57464
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57464
https://github.com/pandas-dev/pandas/pull/57464
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.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks @rhshadrach " ]
2,139,468,884
57,463
DEPR: to_pytimedelta to return Index[object] instead
closed
2024-02-16T20:57:11
2024-04-23T17:21:59
2024-04-23T17:21:59
https://github.com/pandas-dev/pandas/issues/57463
true
null
null
mroeschke
1
https://github.com/pandas-dev/pandas/pull/52459 did this for `to_pydatetime`, so we should do the same for `to_pytimedelta`
[ "Timedelta", "Deprecate" ]
0
0
0
0
0
0
0
0
[ "I'm working on this issue" ]
2,139,259,674
57,462
REGR: Behavior differs when adding Series to frame between matching and non matching index
closed
2024-02-16T19:10:24
2024-04-23T18:50:50
2024-04-23T18:50:49
https://github.com/pandas-dev/pandas/pull/57462
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57462
https://github.com/pandas-dev/pandas/pull/57462
phofl
2
follow up to #56426 this was inconsistent now for matching vs non-matching cc @lukemanley
[ "Numeric Operations", "Stale" ]
0
0
0
0
0
0
0
0
[ "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.", "Looks like this PR has gone stale and needs a rebase. Closing to clear the queue but feel free to reopen if you have time to circle back" ]
2,139,213,239
57,461
DOC: add section Raises to PeriodIndex docstring
closed
2024-02-16T18:47:16
2024-02-16T20:53:52
2024-02-16T20:53:46
https://github.com/pandas-dev/pandas/pull/57461
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57461
https://github.com/pandas-dev/pandas/pull/57461
natmokval
1
we raise a ValueError: "freq not specified and cannot be inferred" if both freq and dtype are not specified in `PeriodIndex` ``` >>> pd.PeriodIndex(["2023-01-01", "2023-02-01", "2023-03-01", "2023-04-01"], freq="M") PeriodIndex(['2023-01', '2023-02', '2023-03', '2023-04'], dtype='period[M]') >>> pd.PeriodIndex(["2023-01-01", "2023-02-01", "2023-03-01", "2023-04-01"], dtype ="period[M]") PeriodIndex(['2023-01', '2023-02', '2023-03', '2023-04'], dtype='period[M]') >>> pd.PeriodIndex(["2023-01-01", "2023-02-01", "2023-03-01", "2023-04-01"]) ValueError: freq not specified and cannot be inferred ``` I added a section "Raises" to `PeriodIndex` documentation.
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "Thanks @natmokval " ]
2,139,119,716
57,460
Backport PR #57402 on branch 2.2.x (BUG: wrong future Warning on string assignment in certain condition)
closed
2024-02-16T17:57:53
2024-02-16T19:21:46
2024-02-16T19:21:45
https://github.com/pandas-dev/pandas/pull/57460
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57460
https://github.com/pandas-dev/pandas/pull/57460
meeseeksmachine
0
Backport PR #57402: BUG: wrong future Warning on string assignment in certain condition
[ "Warnings", "PDEP6-related" ]
0
0
0
0
0
0
0
0
[]
2,139,012,377
57,459
PERF: DataFrame(ndarray) constructor ensure to copy to column-major layout
closed
2024-02-16T17:01:18
2024-03-07T08:33:08
2024-03-05T00:56:59
https://github.com/pandas-dev/pandas/pull/57459
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57459
https://github.com/pandas-dev/pandas/pull/57459
jorisvandenbossche
5
Closes https://github.com/pandas-dev/pandas/issues/50756 xref https://github.com/pandas-dev/pandas/issues/57431 With CoW enabled now, the default behaviour of `DataFrame(ndarray)` is to copy the numpy array (before 3.0, this would not copy the data). However, if we do a copy, we should also make sure we copy it to the optimal layout (typically column major). Before CoW, this copy would often happen later on anyway, and an explicit `copy()` actually does ensure column-major layout: On main: ``` >>> arr = np.random.randn(10, 3) >>> df = pd.DataFrame(arr) # does actually make a copy of `arr` under the hood >>> df._mgr.blocks[0].values.flags.c_contiguous False >>> df2 = df.copy() # explicit copy method >>> df2._mgr.blocks[0].values.flags.c_contiguous True ```
[ "Performance", "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "\r\nWith the change, the result of the [arithmetic.FrameWithFrameWide.time_op_different_blocks op=; shape=(1000000, 10)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20floordiv%3E&p-shape=%281000000%2C%2010%29)\r\n\r\n```\r\nn_rows, n_cols = 1_000_000, 10\r\n\r\n# construct dataframe with 2 blocks\r\narr1 = np.random.randn(n_rows, n_cols // 2).astype(\"f8\")\r\narr2 = np.random.randn(n_rows, n_cols // 2).astype(\"f4\")\r\ndf = pd.concat([DataFrame(arr1), DataFrame(arr2)], axis=1, ignore_index=True)\r\ndf._consolidate_inplace()\r\n\r\narr1 = np.random.randn(n_rows, max(n_cols // 4, 3)).astype(\"f8\")\r\narr2 = np.random.randn(n_rows, n_cols // 2).astype(\"i8\")\r\narr3 = np.random.randn(n_rows, n_cols // 4).astype(\"f8\")\r\ndf2 = pd.concat(\r\n [DataFrame(arr1), DataFrame(arr2), DataFrame(arr3)],\r\n axis=1,\r\n ignore_index=True,\r\n)\r\ndf2._consolidate_inplace()\r\n\r\n%timeit df > df2\r\n```\r\n\r\ngives\r\n\r\n```\r\nIn [4]: %timeit df > df2\r\n21.3 ms ± 3.97 ms per loop (mean ± std. dev. of 7 runs, 100 loops each) # main\r\n8.18 ms ± 1.52 ms per loop (mean ± std. dev. of 7 runs, 100 loops each) # PR\r\n```", "We actually discussed before that we should do this for CoW -> https://github.com/pandas-dev/pandas/issues/50756, and it was also at some point included in PR https://github.com/pandas-dev/pandas/pull/51731 but then removed again before merging.", "Looks reasonable to me. The perf improvement is real nice.", "Thanks @jorisvandenbossche ", "Conbench complaining on these benchmarks:\r\n\r\n `io.hdf.HDF.time_write_hdf` (Python) with format='fixed'\r\n `stat_ops.FrameOps.time_op` (Python) with axis=None, dtype='int', op='median'\r\n `arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0` (Python) with me='pow'\r\n `io.hdf.HDFStoreDataFrame.time_write_store_table_wide` (Python)\r\n `frame_methods.Where.time_where` (Python) with dtype=True, param2='float64'\r\n `stat_ops.FrameOps.time_op` (Python) with axis=None, dtype='float', op='median'\r\n `reshape.Unstack.time_without_last_row` (Python) with param1='int'\r\n `stat_ops.FrameOps.time_op` (Python) with axis=None, dtype='float', op='kurt'\r\n `groupby.GroupManyLabels.time_sum` (Python) with ncols=1000\r\n `frame_methods.Rank.time_rank` (Python) with dtype='uint'\r\n `rolling.TableMethod.time_apply` (Python) with method='table'\r\n `reshape.Unstack.time_full_product` (Python) with param1='int'\r\n `stat_ops.FrameOps.time_op` (Python) with axis=None, dtype='float', op='skew'\r\n\r\nPlease ignore if this was expected.\r\n\r\n<img width=\"1231\" alt=\"Screenshot 2024-03-06 at 18 56 59\" src=\"https://github.com/pandas-dev/pandas/assets/11835246/6245dfbe-1d92-4805-b781-aa8a4724c808\">\r\n\r\n@jorisvandenbossche " ]
2,138,988,285
57,458
PERF: use copy=False in constructor in unstack (CoW)
closed
2024-02-16T16:49:11
2024-02-19T11:15:32
2024-02-19T11:15:29
https://github.com/pandas-dev/pandas/pull/57458
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57458
https://github.com/pandas-dev/pandas/pull/57458
jorisvandenbossche
1
xref https://github.com/pandas-dev/pandas/issues/57431 I _think_ we are sure that the `values` from `self.get_new_values(..)`, which we pass here to the DataFrame constructor, are always new values owned by us (not shared by any other object), and so we can safely set `copy=False` in that case. Mimicking the `time_unstack` benchmark: ``` m = 100 n = 1000 levels = np.arange(m) index = pd.MultiIndex.from_product([levels] * 2) columns = np.arange(n) values = np.arange(m * m * n).reshape(m * m, n) df = pd.DataFrame(values, index, columns) ``` ``` In [2]: %timeit df.unstack() 316 ms ± 44.9 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # main 228 ms ± 25.1 ms per loop (mean ± std. dev. of 7 runs, 1 loop each) # PR ```
[ "Performance", "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "> I'm not sure that's the case. This path:\r\n\r\nAh, yes, I missed the early `return` there.\r\n\r\nContinued in -> https://github.com/pandas-dev/pandas/pull/57487" ]
2,138,905,886
57,457
BUG: Endianness problem with weird data types and shape
closed
2024-02-16T15:58:37
2024-02-21T07:12:16
2024-02-20T17:11:03
https://github.com/pandas-dev/pandas/issues/57457
true
null
null
ilan-gold
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. - [ ] 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, numpy as np columns = [''] data = [np.array([], dtype='>f8')] index = pd.Index([], dtype='uint64', name='rows') df = pd.DataFrame(dict(zip(columns, data)), index=index) df[df.columns] # or df[['']] ``` ### Issue Description I'm actually not 100% this is a "bug", but it came up in a `hypothesis` test and I whittled it down to this. The error is `ValueError: Big-endian buffer not supported on little-endian compiler` ### Expected Behavior I guess it shouldn't error? ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.6.final.0 python-bits : 64 OS : Darwin OS-release : 22.6.0 Version : Darwin Kernel Version 22.6.0: Wed Oct 4 21:26:23 PDT 2023; root:xnu-8796.141.3.701.17~4/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 : 2023.3.post1 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.3.1 Cython : 3.0.8 pytest : 7.4.4 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None 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.12.2 gcsfs : None matplotlib : 3.8.2 numba : 0.58.1 numexpr : None odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.4 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "good first issue", "Needs Tests" ]
0
0
0
0
0
0
0
0
[ "This doesn't seem to exist on the `main` branch.", "Not sure if it should be open or closed since the `main` check is not necessary.", "Confirmed it is not on main - but a test should still be added. Result of a git bisect shows it was fixed by CoW:\r\n\r\n```\r\ncommit 3b57972ceb49c11198eb0bec6be0006260d48085\r\nAuthor: Patrick Hoefler\r\nDate: Thu Feb 1 09:04:05 2024 +0000\r\n\r\n CoW: Enable CoW by default and remove warning build (#56633)\r\n```\r\n\r\nI thought it might be possible that #57459 reintroduces it, but it does not.\r\n\r\ncc @phofl @jorisvandenbossche ", "@rhshadrach Could you perhaps provide a route forward for me here? Will this be a bug fix in a release or do I need to do some special casing to avoid this situation?", "You can try to set\r\n\r\n```\r\npd.options.mode.copy_on_write = True\r\n```\r\n\r\non 2.2 releases or try the nightly releases where this is enabled by default", "I think the only reason that this specific snippet no longer raises an error on main (or when CoW is enabled in pandas 2.2) is because that it was failing to select columns `df[...]`, and before CoW that would do an actual take on the columns (the traceback points to `Block.take_nd` / `pandas._libs.algos.take_2d_axis1_float64_float64`), and now that no longer does a take. \r\n\r\nIf you do something else that still ends up doing an actual take (eg selecting rows with `df.reindex(index=[0, 1])` with the above snippet), that still gives the same error on main.\r\n\r\nNow, I suppose we just never have supported that? (and so the solution is to teach hypothesis to not generate arrays with non-native endianness for this test?)" ]
2,138,783,039
57,456
BUG: Inconsistent date_range output when using CustomBusinessDay as freq
closed
2024-02-16T14:52:33
2024-08-15T20:17:18
2024-08-15T20:17:18
https://github.com/pandas-dev/pandas/issues/57456
true
null
null
blueharen
5
### 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 from pandas.tseries.offsets import CustomBusinessDay from datetime import datetime offset = CustomBusinessDay(weekmask='Sun Mon Tue Wed Thu') start = datetime(2024, 2, 8, 23) end = datetime(2024, 2, 16, 14) d_range = pd.date_range(start, end, freq=offset) print(d_range) #DatetimeIndex(['2024-02-08 23:00:00', '2024-02-11 23:00:00', # '2024-02-12 23:00:00', '2024-02-13 23:00:00', # '2024-02-14 23:00:00'], # dtype='datetime64[ns]', freq='C') start = datetime(2024, 2, 9, 23) d_range = pd.date_range(start, end, freq=offset) print(d_range) #DatetimeIndex(['2024-02-11 23:00:00', '2024-02-12 23:00:00', # '2024-02-13 23:00:00', '2024-02-14 23:00:00', # '2024-02-15 23:00:00'], # dtype='datetime64[ns]', freq='C') ``` ### Issue Description The last date generated from `date_range` with `start = datetime(2024, 2, 8, 23)` does not equal the last date generated from `date_range` when `start = datetime(2024, 2, 9, 23)`, other arguments unchanged. When the start date falls on a day within the weekmask in `CustomBusinessDay`, `date_range` output does not include 2024-02-15 (Thursday). However, when the start date is on a day not included in the weekmask (Friday or Saturday), `date_range` does include 2024-02-15. ### Expected Behavior With a freq of `CustomBusinessDay(weekmask='Sun Mon Tue Wed Thu')` and an end of 2024-02-16, I'd expect `date_range` to always include 2024-02-15, regardless of start. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : 2e218d10984e9919f0296931d92ea851c6a6faf5 python : 3.10.4.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22621 machine : AMD64 processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United States.1252 pandas : 1.5.3 numpy : 1.24.3 pytz : 2022.7.1 dateutil : 2.8.2 setuptools : 58.1.0 pip : 24.0 Cython : 0.29.32 pytest : 7.2.1 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.0.3 lxml.etree : 4.9.1 html5lib : 1.1 pymysql : 1.0.2 psycopg2 : None jinja2 : 3.1.2 IPython : 8.4.0 pandas_datareader: None bs4 : 4.11.1 bottleneck : None brotli : None fastparquet : None fsspec : None gcsfs : None matplotlib : 3.5.3 numba : None numexpr : None odfpy : None openpyxl : 3.1.1 pandas_gbq : None pyarrow : 15.0.0 pyreadstat : None pyxlsb : None s3fs : None scipy : 1.9.0 snappy : None sqlalchemy : 2.0.12 tables : None tabulate : None xarray : None xlrd : None xlwt : None zstandard : None tzdata : 2023.3 </details>
[ "Bug", "Frequency" ]
0
0
0
0
0
0
0
0
[ "I am guessing the Python range won't return the last value. Does it relate to this issue?", "I can replicate the issue (installed versions given at the bottom). I tried messing around with the inputs a bit, and found some potentially interesting things.\r\n\r\nFor one, this does not appear to be an issue when there is no weekday mask. The following code works as you expect:\r\n```python\r\nimport pandas as pd\r\nfrom pandas.tseries.offsets import CustomBusinessDay\r\nfrom datetime import datetime\r\n\r\nstart = datetime(2024, 2, 8, 23)\r\nend = datetime(2024, 2, 16, 14)\r\nd_range = pd.date_range(start, end)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-08 23:00:00', '2024-02-09 23:00:00',\r\n# '2024-02-10 23:00:00', '2024-02-11 23:00:00',\r\n# '2024-02-12 23:00:00', '2024-02-13 23:00:00',\r\n# '2024-02-14 23:00:00', '2024-02-15 23:00:00'],\r\n# dtype='datetime64[ns]', freq='D')\r\n\r\nstart = datetime(2024, 2, 9, 23)\r\nd_range = pd.date_range(start, end)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-09 23:00:00', '2024-02-10 23:00:00',\r\n# '2024-02-11 23:00:00', '2024-02-12 23:00:00',\r\n# '2024-02-13 23:00:00', '2024-02-14 23:00:00',\r\n# '2024-02-15 23:00:00'],\r\n# dtype='datetime64[ns]', freq='D')\r\n```\r\n\r\nI thought it might have something to do with the fact that the `end` day given falls on a masked weekday, so I tried the following code (just shifting the end date back by one, but also masking Thursdays), but it also worked as expected:\r\n```python\r\nimport pandas as pd\r\nfrom pandas.tseries.offsets import CustomBusinessDay\r\nfrom datetime import datetime\r\n\r\nstart = datetime(2024, 2, 8, 23)\r\nend = datetime(2024, 2, 15, 14)\r\noffset = CustomBusinessDay(weekmask='Sun Mon Tue Wed')\r\nd_range = pd.date_range(start, end, freq=offset)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-11 23:00:00', '2024-02-12 23:00:00',\r\n# '2024-02-13 23:00:00', '2024-02-14 23:00:00'],\r\n# dtype='datetime64[ns]', freq='C')\r\n\r\nstart = datetime(2024, 2, 9, 23)\r\nd_range = pd.date_range(start, end, freq=offset)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-11 23:00:00', '2024-02-12 23:00:00',\r\n# '2024-02-13 23:00:00', '2024-02-14 23:00:00'],\r\n# dtype='datetime64[ns]', freq='C')\r\n```\r\n\r\nAfter that, I thought maybe it had to do with the fact that both the beginning and ending day fell on masked days, so I tried shifting the starting days back by one:\r\n```python\r\nimport pandas as pd\r\nfrom pandas.tseries.offsets import CustomBusinessDay\r\nfrom datetime import datetime\r\n\r\nstart = datetime(2024, 2, 7, 23)\r\nend = datetime(2024, 2, 15, 14)\r\noffset = CustomBusinessDay(weekmask='Sun Mon Tue Wed')\r\nd_range = pd.date_range(start, end, freq=offset)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-07 23:00:00', '2024-02-11 23:00:00',\r\n# '2024-02-12 23:00:00', '2024-02-13 23:00:00'],\r\n# dtype='datetime64[ns]', freq='C')\r\n\r\nstart = datetime(2024, 2, 8, 23)\r\nd_range = pd.date_range(start, end, freq=offset)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-11 23:00:00', '2024-02-12 23:00:00',\r\n# '2024-02-13 23:00:00', '2024-02-14 23:00:00'],\r\n# dtype='datetime64[ns]', freq='C')\r\n```\r\n\r\nSo it seems like the problem does exist in this case, which was also the case of the original example given. After that, I tried to change the `end` date to not be on a day where there was a mask, so I kept everything the same, but shifted the end back by a day. It seems to work as expected in that case:\r\n```python\r\nimport pandas as pd\r\nfrom pandas.tseries.offsets import CustomBusinessDay\r\nfrom datetime import datetime\r\n\r\nstart = datetime(2024, 2, 7, 23)\r\nend = datetime(2024, 2, 14, 14)\r\noffset = CustomBusinessDay(weekmask='Sun Mon Tue Wed')\r\nd_range = pd.date_range(start, end, freq=offset)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-07 23:00:00', '2024-02-11 23:00:00',\r\n# '2024-02-12 23:00:00', '2024-02-13 23:00:00'],\r\n# dtype='datetime64[ns]', freq='C')\r\n\r\nstart = datetime(2024, 2, 8, 23)\r\nd_range = pd.date_range(start, end, freq=offset)\r\nprint(d_range)\r\n#DatetimeIndex(['2024-02-11 23:00:00', '2024-02-12 23:00:00',\r\n# '2024-02-13 23:00:00'],\r\n# dtype='datetime64[ns]', freq='C')\r\n```\r\n\r\nSo, overall, seems like it takes effect when the start and end days fall on masked days of the week.\r\n\r\n<details>\r\n <summary>Version details</summary>\r\n INSTALLED VERSIONS\r\n------------------\r\ncommit : a671b5a8bf5dd13fb19f0e88edc679bc9e15c673\r\npython : 3.10.9.final.0\r\npython-bits : 64\r\nOS : Windows\r\nOS-release : 10\r\nVersion : 10.0.22000\r\nmachine : AMD64\r\nprocessor : Intel64 Family 6 Model 142 Stepping 10, GenuineIntel\r\nbyteorder : little\r\nLC_ALL : None\r\nLANG : None\r\nLOCALE : English_United States.1252\r\n\r\npandas : 2.1.4\r\nnumpy : 1.26.4\r\npytz : 2022.1\r\ndateutil : 2.8.2\r\nsetuptools : 65.5.0\r\npip : 24.0\r\nCython : 0.29.28\r\npytest : 7.4.4\r\nhypothesis : None\r\nsphinx : None\r\nblosc : None\r\nfeather : None\r\nxlsxwriter : None\r\nlxml.etree : 4.9.1\r\nhtml5lib : None\r\npymysql : None\r\npsycopg2 : None\r\njinja2 : 3.1.2\r\nIPython : 8.4.0\r\npandas_datareader : None\r\nbs4 : 4.11.1\r\nbottleneck : None\r\ndataframe-api-compat: None\r\nfastparquet : None\r\nfsspec : 2022.7.1\r\ngcsfs : None\r\nmatplotlib : 3.7.1\r\nnumba : None\r\nnumexpr : None\r\nodfpy : None\r\nopenpyxl : 3.1.2\r\npandas_gbq : None\r\npyarrow : 9.0.0\r\npyreadstat : None\r\npyxlsb : None\r\ns3fs : None\r\nscipy : 1.11.1\r\nsqlalchemy : None\r\ntables : None\r\ntabulate : None\r\nxarray : 2023.2.0\r\nxlrd : None\r\nzstandard : None\r\ntzdata : 2023.4\r\nqtpy : 2.3.0\r\npyqt5 : None\r\n\r\n</details>", "take", "take", "This bug (#57456) is no longer reproduced on the main branch of `pandas`, because it is fixed after PR #56831.\r\nAdded a test for the discussed case in PR #59519. " ]
2,138,688,990
57,455
Backport PR #57450 on branch 2.2.x (DOC: Set verbose parameter as deprecated in docstring)
closed
2024-02-16T14:02:29
2024-02-16T17:26:33
2024-02-16T17:26:32
https://github.com/pandas-dev/pandas/pull/57455
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57455
https://github.com/pandas-dev/pandas/pull/57455
meeseeksmachine
0
Backport PR #57450: DOC: Set verbose parameter as deprecated in docstring
[ "Docs", "IO CSV" ]
1
0
0
0
0
0
0
0
[]
2,138,688,533
57,454
Release the gil in take for axis=1
closed
2024-02-16T14:02:11
2024-02-18T11:44:10
2024-02-16T16:05:18
https://github.com/pandas-dev/pandas/pull/57454
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57454
https://github.com/pandas-dev/pandas/pull/57454
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. We missed this when we took care of axis=0 in Basel
[]
0
0
0
0
0
0
0
0
[ "Thanks @phofl ", "@meeseeksdev backport 2.2.x", "I'd like to backport this, it should be very very minor but makes debugging performance shit in dask quite cumbersome (cc @mroeschke for visibility)" ]
2,138,662,863
57,453
BUG: Inconsistent handling of named column indices in to_csv() and read_csv().
open
2024-02-16T13:48:26
2024-02-24T01:52:56
null
https://github.com/pandas-dev/pandas/issues/57453
true
null
null
normanius
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. ### Issue Description Apparently, it is not possible to read in a .csv table with named column index AND named row index. How to reproduce: ```python import pandas as pd import numpy as np np.random.seed(0) df = pd.DataFrame(np.random.randn(5,3), columns=["A", "B", "C"]).round(1) df.index.name = "Count" df.columns.name = "Name" # INCONSISTENCY 1: # .to_csv() only saves the row index name, it ignores the column index name. df.to_csv("out.csv") # The work-around: convert to column index to MultiIndex df.columns = pd.MultiIndex.from_arrays([df.columns]) # Now, .to_csv() stores both column and index names. df.to_csv("out.csv") ``` This is how the file looks like: ```lang-none Name,A,B,C Count,,, 0,1.8,0.4,1.0 1,2.2,1.9,-1.0 2,1.0,-0.2,-0.1 3,0.4,0.1,1.5 4,0.8,0.1,0.4 ``` However, when reading in, I found no way to preserve both the index name of row and column indices. ```python df_new = pd.read_csv("out.csv") print(df_new) # ==> Line 1 is a row instead of column header df_new = pd.read_csv("out.csv", header=[0]) print(df_new) # ==> Line 1 is a row instead of column header df_new = pd.read_csv("out.csv", header=[0, 1]) print(df_new) # ==> Creates a two-level multi-index column header df_new = pd.read_csv("out.csv", header=[0, 1], index_col=[0]) print(df_new) # ==> Creates a two-level multi-index column header df_new = pd.read_csv("out.csv", header=[1], index_col=[0]) print(df_new) # ==> Correctly create the row index, but loses the column info df_new = pd.read_csv("out.csv", header=[1], index_col=[0]) print(df_new) # ==> Correctly create the row index, but loses the column info ``` I think this behavior is inconsistent, as switching to a multi-index with two or more levels works as expected: ```python # INCONSISTENCY 2: # A multi-index column header with >1 levels is handled correctly df_mh = df.copy() l1 = list("ABC") l2 = list("abc") df_mh.columns = pd.MultiIndex.from_arrays([l1, l2]) df_mh.columns.names = ["Name1", "Name2"] df_mh.to_csv("out_mh.csv") df_new = pd.read_csv("out_mh.csv", header=[0,1], index_col=[0]) ``` This reads in the CSV correctly. The following SO posts are related: * https://stackoverflow.com/questions/35047842 * https://stackoverflow.com/questions/67499614 ### Expected Behavior In summary, I identified the following inconsistencies: 1. For a simple pd.Index, the row index name is preserved using `to_csv()`. However, the column index name is not preserved. This is unexpected, and at least could be [documented](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.to_csv.html) 2. For the corner case with a pd.MultiIndex using one level, pd.read_csv() fails to read the multi-header back in. I know, it's a corner case. However, the fact that the column index can have a name, and the fact that column and header are both represented using the same object, it is somewhat unexpected that those inconsistencies occur. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.10.5.final.0 python-bits : 64 OS : Darwin OS-release : 21.6.0 Version : Darwin Kernel Version 21.6.0: Thu Sep 29 20:13:56 PDT 2022; root:xnu-8020.240.7~1/RELEASE_ARM64_T6000 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : None.UTF-8 pandas : 2.2.0 numpy : 1.23.1 pytz : 2022.1 dateutil : 2.8.2 setuptools : 58.1.0 pip : 24.0 Cython : 0.29.30 pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.2 html5lib : 1.1 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.1 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 : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "IO CSV", "Needs Discussion" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Is there a format we could use that would be backwards compatible and allow for storing the column index name? If not, I do not think we should make a backwards incompatible change to support it. But we can document that it will get ignored.\r\n\r\nAs an aside, the CSV format is a good way to store simple tabular data in readable plaintext, but it is not a good format for round-tripping. If you are looking for round-tripping, I would suggest parquet.", "Thank you for the answer. Yes, I totally agree with your point that CSV is a limited format and that Parquet and perhaps HDF5 are more suitable. It still occurs to me that when working with technically less skilled persons, CSV is hard to avoid.\r\n\r\n\r\nI don't exactly get the rational for the following behavior:\r\n\r\n```python\r\n# Two-level header\r\ndf1 = pd.read_csv(\"data.csv\", header=[0,1], index_col=[0])\r\n# One-level header\r\ndf2 = pd.read_csv(\"data.csv\", header=[0], index_col=[0])\r\n```\r\n\r\ndf1 is read as expected, with and without named column-levels, and also if the row index is not named. Note that depending on the presence of a row index name, read_csv() consumes either two or three lines before reading in the row data. So read_csv() can choose correctly based on some inner logic which case applies. For this special logic to be triggered, one has to provide both the arguments `header=[0,1]` and `index_col=[0]`. In this sense, the special reading logic is explicitly requested.\r\n\r\nHowever, in the case of a single-level column index, pandas cannot correctly distinguish between the case with and without index name, that is, a CSV with or without an extra second line reserved for the row index name. Why is this ability lost?\r\n\r\nThe backwards compatibility requirement could be circumvented by using an extra flag. However, read_csv() already has a lot of parameters, so that introducing another argument affects the usability. In that sense, I'm also not so fond of adding an extra parameter.", "> However, in the case of a single-level column index, pandas cannot correctly distinguish between the case with and without index name, that is, a CSV with or without an extra second line reserved for the row index name. Why is this ability lost?\r\n\r\nI do not know the reason, I think investigation here is necessary. If there is a way to make this more consistent and it's backwards compatible, then I'd likely be positive on the change. \r\n\r\n> In that sense, I'm also not so fond of adding an extra parameter.\r\n\r\nAgreed.", "I looked into this for a bit and the internal logic behind\r\n`df_new = pd.read_csv(\"out_mh.csv\", header=[0,1], index_col=[0])`\r\nthat infers a third header row has at least four more minor issues related to input sanitizing in addition to being inconsistent with the non-MultiIndex case: \r\n1. Adding a trailing comma to csv line 2 while using `engine=python` does not lead to a `ParserError(\"Header rows must have an equal number of columns.\")` and the csv gets parsed as before. Technically this is also a header, but one can argue the specialness of this row...\r\n2. Doing the above for the c engine leads to a mangled index, with the MultiIndex being interpreted as tuples `Index([0, ('A', 'a'), ('B', 'b'), ('C', 'c')], dtype='object')`\r\n3. Doing the above for the pyarrow engine leads to a `TypeError: an integer is required` \r\n4. Removing all values from line 2 leads to only the MultiIndex with two levels being created when using the c and python engine, the empty inferred header row being ignored. Under pyarrow, this leads to exception 3.\r\n\r\n\r\n\r\nOne of the potentially backwards compatible options for providing the index name would be to have an additional header row that has one more column than the other header rows. It would start with the index name and otherwise only contain delimiters. One could then explicitly include this additional row in the `header` list (in our MultiIndex example `header=[0,1,2]`). The extraneous column would distinguish this type of header row from one that is supposed to contain an additional MultiIndex level with generated default column names.\r\n \r\nPotentially backwards compatible since this kind of index name row is currently either \r\n\r\n- illegal when explicitly providing this index name row (exception from issue 1.), or\r\n- leads to a bug (2.) or an error (3.) when depending on the inferring logic when using a MultiIndex \r\n\r\nThough this solution seems hackish to me. \r\n\r\nI would at least look into fixing the inferring logic inconsistencies 1.-4." ]
2,138,484,919
57,452
BUG: to_datetime fails to infer timeformat depending on hour of day
closed
2024-02-16T12:10:40
2024-02-21T19:14:11
2024-02-21T19:14:11
https://github.com/pandas-dev/pandas/issues/57452
true
null
null
roj516
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. - [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 pandas._libs.tslibs.parsing import guess_datetime_format import dateutil import time def demo(): print(pd.__version__) print(guess_datetime_format("2023-11-09T19:23:46Z")) print(guess_datetime_format("2023-11-09T20:23:46Z")) print(dateutil.__version__) print(dateutil.parser.parse("2023-11-09T19:23:46Z")) print(dateutil.parser.parse("2023-11-09T20:23:46Z")) print(dateutil.parser.DEFAULTPARSER._parse("2023-11-09T19:23:46Z")) print(dateutil.parser.DEFAULTPARSER._parse("2023-11-09T20:23:46Z")) print(time.tzname) 2.2.0 %Y-%m-%dT%H:%M:%S%z None 2.8.2 2023-11-09 19:23:46+00:00 2023-11-09 20:23:46+00:00 (_result(year=2023, month=11, day=9, hour=19, minute=23, second=46, microsecond=0, tzname='UTC', tzoffset=0), None) (_result(year=2023, month=11, day=9, hour=20, minute=23, second=46, microsecond=0, tzname='UTC', tzoffset=0), None) ('CET', 'CEST') 3.0.0.dev0+355.g92a52e2315 %Y-%m-%dT%H:%M:%S%z None 2.8.2 2023-11-09 19:23:46+00:00 2023-11-09 20:23:46+00:00 (_result(year=2023, month=11, day=9, hour=19, minute=23, second=46, microsecond=0, tzname='UTC', tzoffset=0), None) (_result(year=2023, month=11, day=9, hour=20, minute=23, second=46, microsecond=0, tzname='UTC', tzoffset=0), None) ('CET', 'CEST') ``` ### Issue Description If the first data value is 2023-11-09T19:23:46Z to_datetime infers format. If the first data value is 2023-11-09T20:23:46Z inference fails with: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format. ### Expected Behavior Format should be inferred. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : 92a52e231534de236c4e878008a4365b4b1da291 python : 3.12.1.final.0 python-bits : 64 OS : Darwin OS-release : 23.3.0 Version : Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:10 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6031 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 3.0.0.dev0+355.g92a52e2315 numpy : 2.0.0.dev0+git20240210.2946577 pytz : 2024.1 dateutil : 2.8.2 setuptools : None 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 : 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 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 : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "datetime.date" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. This only happens for times between 20:23:00 and 20:23:59 (inclusive). Further investigations and PRs to fix are welome.", "Interesting. It seems this happens when year and hour:minute have the same number (e.g., 2023 and 20:23). I would like to try to submit a fix. @rhshadrach " ]
2,138,400,470
57,451
DOC: Parameter verbose does not appear as deprecated
closed
2024-02-16T11:21:57
2024-02-16T14:01:46
2024-02-16T14:01:45
https://github.com/pandas-dev/pandas/issues/57451
true
null
null
albertvillanova
0
### 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/pandas-docs/stable/reference/api/pandas.read_csv.html https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_table.html ### Documentation problem The parameter "verbose" was deprecated in 2.2.0 but this fact does not appear in the corresponding docstrings. See: - #56556 ### Suggested fix for documentation The "deprecated" Sphinx directive should be added to the docstring.
[ "Docs", "Needs Triage" ]
0
0
0
0
0
0
0
0
[]
2,138,368,283
57,450
DOC: Set verbose parameter as deprecated in docstring
closed
2024-02-16T11:02:22
2024-02-16T14:45:38
2024-02-16T14:01:44
https://github.com/pandas-dev/pandas/pull/57450
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57450
https://github.com/pandas-dev/pandas/pull/57450
albertvillanova
4
This PR follows: - #56556 TODO: - [x] closes #57451 - [ ] [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", "IO CSV" ]
0
0
0
0
0
0
0
0
[ "/preview", "/preview", "thx", "There was a problem with the previewer, seems like GitHub only returns the first 30 elements of a request by default, we've got more than 30 jobs, and the job we needed to download the artifact wasn't being returned. I increased the number of returned items to 100, the maximum, and seems like the preview is working again.\r\n\r\nThis is rendering as expected:\r\n\r\nhttps://pandas.pydata.org/preview/pandas-dev/pandas/57450/docs/reference/api/pandas.read_csv.html\r\n\r\nThanks again @albertvillanova and sorry for the noise." ]
2,137,739,275
57,449
BUG: `read_parquet` times out resolving S3 region
closed
2024-02-16T01:56:49
2024-05-19T18:33:58
2024-05-19T18:33:58
https://github.com/pandas-dev/pandas/issues/57449
true
null
null
hutch3232
5
### 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 os import pandas as pd import s3fs os.environ["AWS_PROFILE"] = "my-bucket-rw" # works perfectly df = pd.read_csv("s3://my-bucket/example.csv") # throws error seemingly about the region df = pd.read_parquet("s3://my-bucket/example_parquet") # --------------------------------------------------------------------------- # OSError Traceback (most recent call last) # Cell In[7], line 1 # ----> 1 df = pd.read_parquet("s3://my-bucket/example_parquet") # File /opt/conda/lib/python3.9/site-packages/pandas/io/parquet.py:667, in read_parquet(path, engine, columns, storage_options, use_nullable_dtypes, dtype_backend, filesystem, filters, **kwargs) # 664 use_nullable_dtypes = False # 665 check_dtype_backend(dtype_backend) # --> 667 return impl.read( # 668 path, # 669 columns=columns, # 670 filters=filters, # 671 storage_options=storage_options, # 672 use_nullable_dtypes=use_nullable_dtypes, # 673 dtype_backend=dtype_backend, # 674 filesystem=filesystem, # 675 **kwargs, # 676 ) # File /opt/conda/lib/python3.9/site-packages/pandas/io/parquet.py:267, in PyArrowImpl.read(self, path, columns, filters, use_nullable_dtypes, dtype_backend, storage_options, filesystem, **kwargs) # 264 if manager == "array": # 265 to_pandas_kwargs["split_blocks"] = True # type: ignore[assignment] # --> 267 path_or_handle, handles, filesystem = _get_path_or_handle( # 268 path, # 269 filesystem, # 270 storage_options=storage_options, # 271 mode="rb", # 272 ) # 273 try: # 274 pa_table = self.api.parquet.read_table( # 275 path_or_handle, # 276 columns=columns, # (...) # 279 **kwargs, # 280 ) # File /opt/conda/lib/python3.9/site-packages/pandas/io/parquet.py:117, in _get_path_or_handle(path, fs, storage_options, mode, is_dir) # 114 pa_fs = import_optional_dependency("pyarrow.fs") # 116 try: # --> 117 fs, path_or_handle = pa_fs.FileSystem.from_uri(path) # 118 except (TypeError, pa.ArrowInvalid): # 119 pass # File /opt/conda/lib/python3.9/site-packages/pyarrow/_fs.pyx:471, in pyarrow._fs.FileSystem.from_uri() # File /opt/conda/lib/python3.9/site-packages/pyarrow/error.pxi:154, in pyarrow.lib.pyarrow_internal_check_status() # File /opt/conda/lib/python3.9/site-packages/pyarrow/error.pxi:91, in pyarrow.lib.check_status() # OSError: When resolving region for bucket 'my-bucket': AWS Error NETWORK_CONNECTION during HeadBucket operation: curlCode: 28, Timeout was reached # the following two approaches work df = pd.read_parquet("s3://my-bucket/example_parquet", storage_options = {"client_kwargs": { "verify": os.getenv("AWS_CA_BUNDLE") }}) s3 = s3fs.S3FileSystem() df = pd.read_parquet(file, filesystem = s3) ``` ### Issue Description I was not sure where to report this issue because it probably involves `pandas`, `pyarrow`, `s3fs` and `fsspec`. FWIW I'm using an S3 Compatible Storage called [Scality](https://www.scality.com/ring/). As the example code shows, I'm able to use `read_csv` with the only configuration being the `AWS_PROFILE` environmental variable. Trying the analogous `read_parquet` it times out and seems as if it can't resolve the region. My S3-compatible instance is on-premises so there isn't a "region", however setting `AWS_DEFAULT_REGION` to `""` also did not solve this. Interestingly, supplying either of `AWS_CA_BUNDLE` to `storage_options` or supplying the `filesystem` argument fixes this. Worth noting that in my `~/.aws/config` file the `region` and `ca_bundle` values are provided (as is `endpoint_url`). ### Expected Behavior I think `read_parquet` should behave like `read_csv` and be able to access and read the data without passing in additional configuration. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.9.16.final.0 python-bits : 64 OS : Linux OS-release : 4.18.0-513.9.1.el8_9.x86_64 Version : #1 SMP Thu Nov 16 10:29:04 EST 2023 machine : x86_64 processor : x86_64 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.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.1.0 pip : 24.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None 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 : 2024.2.0 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 : 2024.2.0 scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : 0.19.0 tzdata : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "IO Network", "IO Parquet", "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Grepping the pandas code, I find no instances of `AWS_PROFILE`. I don't think pandas is doing anything special in `read_csv`, so it seems likely this is not a pandas issue.", "```Python\r\n# works perfectly\r\ndf = pd.read_csv(\"s3://my-bucket/example.csv\")\r\n\r\n# throws error seemingly about the region\r\ndf = pd.read_parquet(\"s3://my-bucket/example_parquet\")\r\n```\r\n\r\nJust to make sure; your `read_csv` includes a file extension, the `read_parquet` doesn't.\r\nIs that intentional?", "Appreciate you both taking a look at this.\r\n\r\nI agree, it's odd I didn't include an extension. I did that because generally I'm working with multipart parquets from Spark which are stored in a folder. \r\n\r\nThat said, I was doing this testing with a single parquet file, and I just repeated it now with a proper extension and the same result occurs. Thanks for the suggestion though, it was worth trying.", "Dj", "Agreed this doesn't appear to be a pandas issue, additionally it appears this is being raised in pyarrow so I would suggest seeing if you are getting the same error with using pyarrow's read_parquet itself so closing" ]
2,137,729,540
57,448
BUG(?): Non nano + DatetOffset(component=0) re-infers resolution
open
2024-02-16T01:43:20
2024-02-16T18:18:49
null
https://github.com/pandas-dev/pandas/issues/57448
true
null
null
mroeschke
3
```python In [1]: import pandas as pd; from io import StringIO; import numpy as np In [2]: ser = pd.Series(pd.DatetimeIndex(["2000-01-01 00:00:00.012"], dtype="datetime64[ms]")) In [3]: ser Out[3]: 0 2000-01-01 00:00:00.012 dtype: datetime64[ms] In [4]: ser + pd.DateOffset(microseconds=0) # 2.1.4 Out[4]: 0 2000-01-01 00:00:00.012 dtype: datetime64[ms] In [3]: ser + pd.DateOffset(microseconds=0). # main Out[3]: 0 2000-01-01 00:00:00.012 dtype: datetime64[us] ``` Possibly from https://github.com/pandas-dev/pandas/pull/55595. Should the resolution be re-inferred here? cc @jbrockmendel
[ "Numeric Operations", "Frequency", "Non-Nano" ]
0
0
0
0
0
0
0
0
[ "i think bc you passed microseconds=0, offset._pd_timedelta comes back with unit=\"us\", which is why this gets upcast", "Would it be worth no-oping these cases though? ", "i dont think so, no. This is analogous to `pd.Timedelta(0).as_unit(\"us\")` in that the \"us\" unit is informative despite the value being zero." ]
2,137,693,986
57,447
BUG: binop methods with `fill_value` not being respected in pandas 2.2
open
2024-02-16T01:02:26
2024-04-16T05:56:27
null
https://github.com/pandas-dev/pandas/issues/57447
true
null
null
mroeschke
2
```python In [1]: import pandas as pd; from io import StringIO; import numpy as np In [2]: pd.__version__ Out[2]: '2.1.4' In [3]: ser = pd.Series(pd.array([1, pd.NA], dtype="Float64")) In [4]: ser.eq(np.nan, fill_value=0.0). # 2.1.4 Out[4]: 0 False 1 False dtype: boolean In [4]: ser.eq(np.nan, fill_value=0.0). # 2.2 Out[4]: 0 False 1 <NA> dtype: boolean ``` I would expect `fill_value` to replace NA with 0.0 before comparing with `np.nan` as described in the docs
[ "Missing-data", "Numeric Operations", "NA - MaskedArrays" ]
0
0
0
0
0
0
0
0
[ "I believe behavior was changed in https://github.com/pandas-dev/pandas/pull/55568 but is the 2.2.0 result not the expected result? Since the documentation states that the fill value should only be used when one side is missing, in this case, since the left series is a nullable dtype, should np.nan not be treated as a missing value? I would have thought that even for nullable types, since nan is converted to NA in construction:\r\n\r\n```\r\n>>> pd.Series([np.nan], dtype=\"Float64\")\r\n0 <NA>\r\ndtype: Float64\r\n>>>\r\n```\r\n\r\nIn this example, since both left and right are missing values, fill value should not do a replacement.\r\n\r\n", "The current behavior makes sense (only fill when one side is missing) because it follows the docs, but I can see why this would be confusing. It's entirely reasonable to assume without a close reading that fill_value might fill both sides as opposed to only one side when there's an np.nan." ]
2,137,632,039
57,446
DOC: fix SA05 errors in docstrings for pandas.core.window Expanding and Rolling, and SeriesGroupBy
closed
2024-02-15T23:52:03
2024-02-16T17:24:30
2024-02-16T17:24:30
https://github.com/pandas-dev/pandas/pull/57446
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57446
https://github.com/pandas-dev/pandas/pull/57446
williamking1221
1
- [x] closes #57392 - [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.
[ "Code Style" ]
0
0
0
0
0
0
0
0
[ "Thanks @williamking1221 and @jordan-d-murphy for the review" ]
2,137,626,855
57,445
PERF: Allow RangeIndex.take to return a RangeIndex when possible
closed
2024-02-15T23:45:09
2024-02-20T10:12:15
2024-02-18T21:43:10
https://github.com/pandas-dev/pandas/pull/57445
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57445
https://github.com/pandas-dev/pandas/pull/57445
mroeschke
2
Discovered in https://github.com/pandas-dev/pandas/pull/57441
[ "Performance", "Index" ]
0
0
0
0
0
0
0
0
[ "thx @mroeschke ", "https://asv-runner.github.io/asv-collection/pandas/#frame_methods.SortValues.time_frame_sort_values\r\n\r\nLooks like this caused a pretty bad regression" ]
2,137,565,223
57,444
CLN: Enforce deprecation of using alias for builtin/NumPy funcs
closed
2024-02-15T22:39:46
2024-02-27T22:49:06
2024-02-27T22:47:50
https://github.com/pandas-dev/pandas/pull/57444
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57444
https://github.com/pandas-dev/pandas/pull/57444
rhshadrach
4
- [ ] 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. Ref: #53974
[ "Clean", "Apply" ]
0
0
0
0
0
0
0
0
[ "A bit of a complication here - I missed one of the paths in apply where we use the builtin/NumPy -> cython table.\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/54d2033fabc1a064b05842b41f8247ae3fdd6fd6/pandas/core/apply.py#L1439-L1442\r\n\r\nSadly, it's probably one of the more common cases where users will see a difference. This is because `apply` will first try to operate row-by-row (unless `by_row=False`), and e.g. `np.sum` works on rows.\r\n\r\nI'm thinking we enforce the deprecation as-is (we already were not very consistent with where we were making these replacements), and deprecate the last remaining case as part of 3.x.\r\n\r\ncc @jorisvandenbossche @mroeschke ", "Yes, sounds good to me too!", "@mroeschke - green now.", "Thanks @rhshadrach " ]
2,137,484,109
57,443
DOC: fix GL08 errors in docstrings
closed
2024-02-15T21:30:57
2024-03-29T06:46:43
2024-03-18T02:00:21
https://github.com/pandas-dev/pandas/issues/57443
true
null
null
jordan-d-murphy
18
Pandas has a script for validating docstrings: https://github.com/pandas-dev/pandas/blob/92a52e231534de236c4e878008a4365b4b1da291/ci/code_checks.sh#L144-L415 Currently, some methods fail the GL08 check. The task here is: - take 2-4 methods - run: scripts/validate_docstrings.py --format=actions --errors=GL08 `method-name` - check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported - remove those methods from code_checks.sh - commit, push, open pull request Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs", "CI", "good first issue" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels:\r\n\r\n- CI\r\n- Docs\r\n- good first issue", "addresses https://github.com/pandas-dev/pandas/pull/57360", "take", "working on\r\n pandas.Index.empty\\ \r\n pandas.Index.names\\ \r\n pandas.Index.view\\ ", "working on\r\npandas.IntervalIndex.left\\ \r\npandas.IntervalIndex.length\\ \r\npandas.IntervalIndex.mid\\ ", "Opened a fix for \r\n```\r\npandas.DatetimeIndex.as_unit\r\npandas.DatetimeIndex.freq\r\n```", "Working on\r\npandas.ExcelFile.book\r\npandas.MultiIndex.codes", "Working on \r\npandas.Timedelta.microseconds\r\npandas.Timedelta.unit\r\npandas.Timedelta.value", "Opened a fix for `pandas.core.groupby.SeriesGroupBy.value_counts`", "working on\r\n```\r\npandas.IntervalIndex.right\r\npandas.Series.dt\r\n```", "I am not able to find the proper location.Can anyone help me? I was trying to add docstring for pandas.Period.freq but I am still getting the error \" The object does not have a docstring\r\n\". I was trying to add docstrig to the 'freq' method for the location pandas/core/arrays/period.py.\r\n\r\n", "@pmhatre1 I've had the same experience. I could not locate the correct function to add the docstring to. I've encountered this before, and my suspicion is this is something defined in `.pyx` and `.pyi` files and somehow the docstring is invisible to the validations run in `code_checks.sh` If we could figure out a way to solve this, it would allow us to get fixes for so many of the numpy docstring errors failing validation, sadly, at this time I don't have any solution\r\n ", "Take pandas.Series.dt.freq\\ \r\n pandas.Series.dt.unit\\ \r\n pandas.Series.empty\\ ", "> @pmhatre1 I've had the same experience. I could not locate the correct function to add the docstring to. I've encountered this before, and my suspicion is this is something defined in `.pyx` and `.pyi` files and somehow the docstring is invisible to the validations run in `code_checks.sh` If we could figure out a way to solve this, it would allow us to get fixes for so many of the numpy docstring errors failing validation, sadly, at this time I don't have any solution\r\n\r\nI think you are right @jordan-d-murphy. Can we pull in someone here to help us?", "I would love to hear some ideas from folks that might have suggestions on how to do this. @jrmylow talks about this under [[DOC: fix PR02 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57111#top)](https://github.com/pandas-dev/pandas/issues/57111) in this comment here https://github.com/pandas-dev/pandas/issues/57111#issuecomment-1929460148 maybe we can pursue this?", "Hi all, if [CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826) gets merged in, I might be reworking our approach here; this would look like closing the following issues: \r\n\r\n\r\n> [DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)\r\n> [DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n> [DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n> [DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n> [DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n> [DOC: fix PR02 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57111)\r\n\r\nAnd opening a new issue to address these based on the new approach. \r\n\r\ntl;dr \r\n\r\nthe work can still be done, but probably under a new ticket once #57826 is merged in", "Closed by:\r\n[CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826)\r\n[CI: Better error control in the validation of docstrings #57879](https://github.com/pandas-dev/pandas/pull/57879) \r\n\r\nOpening a new issue to fix docstring errors. ", "Opened [DOC: Enforce Numpy Docstring Validation (Parent Issue) #58063](https://github.com/pandas-dev/pandas/issues/58063) as a parent issue for fixing docstrings based on the refactoring in code_checks.sh \r\n\r\nFeel free to swing by and help out! 🙂" ]
2,137,415,482
57,442
adding pow example for dataframe #57419
closed
2024-02-15T20:42:22
2024-02-20T00:34:31
2024-02-19T23:38:30
https://github.com/pandas-dev/pandas/pull/57442
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57442
https://github.com/pandas-dev/pandas/pull/57442
santhoshbethi
5
Added example for DataFrame.pow() - [x] closes #57419 - [ ] [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
[ "I found that data format in the documentation must be '{{....}}' not '{...}'. \r\n![image](https://github.com/pandas-dev/pandas/assets/31467361/0823a5e4-6422-4f97-8058-ad67a80c4657)\r\n\r\nvalidation by runing command \"python scripts/validate_docstrings.py pandas.DataFrame.pow\"\r\n\r\nHope it can be helpful。 @santhoshbethi\r\n", "Thank you @dawangbaixiaofu\r\n", "https://github.com/pandas-dev/pandas/actions/runs/7942950011/job/21686768999?pr=57442 has failed due to a permission error. Can we rerun this job?\r\n\r\n@dawangbaixiaofu could you please check this one ", "hi @mroeschke . Can you please check this pipeline? What am I missing here?", "Thanks @santhoshbethi " ]
2,137,371,834
57,441
TST: Clean tests that constuct Index equivalent to RangeIndexes
closed
2024-02-15T20:16:45
2024-07-24T16:42:12
2024-07-24T16:42:09
https://github.com/pandas-dev/pandas/pull/57441
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57441
https://github.com/pandas-dev/pandas/pull/57441
mroeschke
1
In preparation if #57436 ever lands.
[ "Testing", "Clean", "Index" ]
0
0
0
0
0
0
0
0
[ "Looks like tests are passing here so merging" ]
2,137,341,955
57,440
DOC: fix ES01 errors in docstrings
closed
2024-02-15T19:59:20
2024-03-29T06:46:48
2024-02-26T17:57:10
https://github.com/pandas-dev/pandas/issues/57440
true
null
null
jordan-d-murphy
15
Pandas has a script for validating docstrings: https://github.com/pandas-dev/pandas/blob/1ca9b5871dc71353185b48362bc84e666229810d/ci/code_checks.sh#L144-L1185 Currently, some methods fail the ES01 check. The task here is: - take 2-4 methods - run: scripts/validate_docstrings.py --format=actions --errors=ES01 `method-name` - check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported - remove those methods from code_checks.sh - commit, push, open pull request Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs", "CI", "good first issue" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels:\r\n\r\n- CI\r\n- Docs\r\n- good first issue\r\n", "addresses https://github.com/pandas-dev/pandas/pull/57359\r\n", "I'll take \r\n```\r\n pandas.Categorical.__array__\r\n pandas.Categorical.as_ordered\r\n pandas.Categorical.as_unordered\r\n pandas.Categorical.ordered\r\n pandas.Categorical.remove_unused_categories\r\n pandas.Categorical.rename_categories\r\n```", "I'll take \r\n\r\n pandas.DataFrame.T\\\r\n pandas.DataFrame.agg\\\r\n", "There is a bit of a circular error happening with this task. Running scripts/validate_docstrings.py --format=actions --errors=ES01 method-name generates an error saying that an extended summary is needed. However, once one is added it states that extended summary is not one of the allowed sections", "Opened a fix for `pandas.Flags`", "Opened fix for to_csv method. Will take more once this get merged.", "Raised a PR for fix of ES01 for below methods:\r\n- pandas.HDFStore.get\r\n- pandas.HDFStore.info \r\n- pandas.HDFStore.keys \r\n- pandas.HDFStore.put", "opened a PR for `pandas.CategoricalDtype`", "@jordan-d-murphy what do you think about intentionally not enforcing ES01 for the docstrings? In my opinion if they just redescribe the parameter section or tell something that would be clearer in an example, I'm skeptical of it's value", "That's a fair point, if it's not adding enough value to be worth enforcing, I can open a PR to remove the block that enforces it. @mroeschke ", "@jordan-d-murphy will this issue then be closed because of https://github.com/pandas-dev/pandas/pull/57625? I had taken a couple methods to update but haven't addressed them yet because of an open question", "Closing due to https://github.com/pandas-dev/pandas/pull/57625", "yup @v-lozko \r\nI opened some more issues that are similar if you'd like to help work on these! \r\n[DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n[DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n[DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n[DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n[DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)", "Opened [DOC: Enforce Numpy Docstring Validation (Parent Issue) #58063](https://github.com/pandas-dev/pandas/issues/58063) as a parent issue for fixing docstrings based on the refactoring in code_checks.sh \r\n\r\nFeel free to swing by and help out! 🙂" ]
2,137,318,235
57,439
BUG: read_json returning Index instead of RangeIndex
closed
2024-02-15T19:48:20
2024-02-21T19:41:06
2024-02-21T19:41:04
https://github.com/pandas-dev/pandas/pull/57439
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57439
https://github.com/pandas-dev/pandas/pull/57439
mroeschke
0
- [x] closes #57429 (Replace xxxx with the GitHub issue number) `_convert_axes` and `_try_convert_data` could both probably use a cleanup to align with pandas standard inference, but this is a minimal change for 2.2.1
[ "IO JSON", "Index" ]
0
0
0
0
0
0
0
0
[]
2,137,314,359
57,438
DOC: fix PR01 errors in docstrings
closed
2024-02-15T19:46:43
2024-03-29T06:46:55
2024-03-18T02:00:31
https://github.com/pandas-dev/pandas/issues/57438
true
null
null
jordan-d-murphy
12
Pandas has a script for validating docstrings: https://github.com/pandas-dev/pandas/blob/719e4a638a4383b859d684db4ad4f7e471a58aaa/ci/code_checks.sh#L144-L467 Currently, some methods fail the PR01 check. The task here is: - take 2-4 methods - run: scripts/validate_docstrings.py --format=actions --errors=PR01 `method-name` - check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported - remove those methods from code_checks.sh - commit, push, open pull request Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs", "CI", "good first issue" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels:\r\n\r\n- CI\r\n- Docs\r\n- good first issue", "Addresses https://github.com/pandas-dev/pandas/pull/57358\r\n", "Thanks @Deen-dot for fixing \r\n```\r\npandas.Grouper\r\npandas.core.groupby.DataFrameGroupBy.cummax\r\npandas.core.groupby.DataFrameGroupBy.cummin\r\npandas.core.groupby.DataFrameGroupBy.cumprod\r\npandas.core.groupby.DataFrameGroupBy.cumsum\r\npandas.core.groupby.DataFrameGroupBy.filter\r\npandas.core.groupby.DataFrameGroupBy.pct_change\r\npandas.core.groupby.DataFrameGroupBy.rolling\r\npandas.core.groupby.SeriesGroupBy.nunique\r\npandas.core.groupby.SeriesGroupBy.cummax\r\npandas.core.groupby.SeriesGroupBy.cummin\r\npandas.core.groupby.SeriesGroupBy.cumprod\r\npandas.core.groupby.SeriesGroupBy.cumsum\r\npandas.core.groupby.SeriesGroupBy.cumprod\r\n```", "I'll take: \r\n```\r\npandas.Categorical\r\npandas.Categorical.__array__\r\n```", "Opened a fix for \r\n```\r\npandas.CategoricalIndex.equals \r\npandas.CategoricalIndex.map\r\n```", "I'll take\r\n```\r\npandas.ExcelFile\r\npandas.ExcelFile.parse\r\n```", "I'll take\r\n``` \r\npandas.DataFrame.at_time\r\npandas.DataFrame.backfill\r\n```", "opened a PR for \r\n```\r\npandas.melt\r\npandas.option_context\r\npandas.read_fwf\r\npandas.reset_option\r\n\r\n```", "I would like to work on these if they are not taken:\r\n pandas.Index.get_indexer_for\\\r\n pandas.Index.identical\\\r\nthey are lines 420-421 on pandas/ci/code_checks.sh (I am new to working on open-source repo's so I don't know how to make the format of the above lines look good)", "Hi all, if [CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826) gets merged in, I might be reworking our approach here; this would look like closing the following issues: \r\n\r\n\r\n> [DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)\r\n> [DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n> [DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n> [DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n> [DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n> [DOC: fix PR02 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57111)\r\n\r\nAnd opening a new issue to address these based on the new approach. \r\n\r\ntl;dr \r\n\r\nthe work can still be done, but probably under a new ticket once #57826 is merged in", "Closed by:\r\n[CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826)\r\n[CI: Better error control in the validation of docstrings #57879](https://github.com/pandas-dev/pandas/pull/57879) \r\n\r\nOpening a new issue to fix docstring errors. ", "Opened [DOC: Enforce Numpy Docstring Validation (Parent Issue) #58063](https://github.com/pandas-dev/pandas/issues/58063) as a parent issue for fixing docstrings based on the refactoring in code_checks.sh \r\n\r\nFeel free to swing by and help out! 🙂" ]
2,137,194,083
57,437
BUG: Future limitation to prevent automatic type cast makes instantiation of empty series impossible
closed
2024-02-15T18:42:36
2024-02-18T20:46:35
2024-02-18T20:46:35
https://github.com/pandas-dev/pandas/issues/57437
true
null
null
KingOtto123
10
### 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 my_index = pd.Index([1, 2, 3]) ds = pd.Series(None, index=my_index) ds.iloc[0] = "a" ``` ### Issue Description This raises the following error: `FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value 'a' has dtype incompatible with float64, please explicitly cast to a compatible dtype first.` However, the error is due to the fact that pandas itself inferred a format for `None`. So the library produces an error of its own making. ### Expected Behavior Continue to allow assinging records of any type to empty Series. In particular: If `None` was instantiated and user assigns anything of type `str` or `int`, this should be fine ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.11.8.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : Intel64 Family 6 Model 165 Stepping 5, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_Switzerland.1252 pandas : 2.2.0 numpy : 1.26.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 68.2.0 pip : 24.0 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 : 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 : 2.9.0 odfpy : None openpyxl : None 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 : None zstandard : None tzdata : 2024.1 qtpy : None pyqt5 : None </details>
[ "Needs Discussion", "Closing Candidate", "PDEP6-related" ]
0
0
0
0
0
0
0
0
[ "cc @MarcoGorelli ", "Thanks for the report!\r\n\r\n> Continue to allow assinging records of any type to empty Series.\r\n\r\nThe Series above has length 3 and so is not empty - unless maybe you're thinking of \"a Series with all NA values\" as being empty? I would advise not calling this an empty Series - in particular:\r\n\r\n```\r\nprint(ds.empty)\r\n# False\r\n```\r\n\r\nBut even empty Series have dtypes, and assigning a value into an empty Series resulting in an upcast has all the same problems with assigning a value into a non-empty Series that lead to PDEP6. \r\n\r\nIn addition, I'd recommend controlling your dtypes when possible: relying on pandas to do inference and guess at what dtype you want can lead to unexpected errors down the road.", "Thanks, [rhshadrach](https://github.com/rhshadrach)!\r\nAs this was a \"discussion expected\", let me add a few points where I think I disagree with you, and why I would still calls this a highly undesirable (i.e., buggy) behavior:\r\n- The command does NOT assign any data to the Series. While I agree with your observation that `ds` is not empty, it is only not empty after initialization because pandas has already filled it with `NaN` during initialization. Thereby, pandas has assigned the `dtype=float64` on the fly. However, this is absolutely not intended when the user types `None` (it's a pretty long shot to argue that `None` is always of type `float`). It is a clearly a side effect of intialization. Agree?\r\n- So as a consequence of this initialization, a very simple assigment such as `=2` or `=\"a\"` becomes prohibited.\r\n\r\nWhere is the problem with this, in my opinion? -> It raises the more fundamental question whether it should - fundamentally - be allowed to initialize a pandas Series without specifying the type. I think it should, but version `2.2.0` effectively prohibits that: \r\n- A type is automatically assigned (=`float`), even for an emtpy set (I would still hold up that `None` is empty, at least at the time of input, even if not after initialization). That has been the case for long - no issue here. BUT:\r\n- Pandas (now!) forces the user to re-assign a different type before doing anything other than `float` with this\r\nI think this fundamentally violates the idea of python (types do not need to be declared for variables to work) and even panda (assingment without `dtype` is in fact possible).\r\n\r\nSo the current way of handling this is just inconsistent. On the one hand, you say \"Ah, pandas is flexible, so you don't need to define the type. Doing `None` is just fine, pandas will handle it for you and set it to `float`.\" But then later you come back and say \"wait, type must be defined, automatic cast is prohibited. you wanted something empty? too bad, now you're stuck with `float`, no flexibility in assinging anything different, now\".\r\n\r\nThe proper way to handle this would be - in my opinion\r\n- either you hold up the argument that type must be defined, strictly, at time of initialization. Then let's \"enforce\" that the user declares the type at definition (consequence: then `pd.Series(None)` should raise, always, as type is not defined)\r\n- or, \"allow\" the user to declare something empty (then `pd.Series(None)` should work) but then also allow to fill empty with \"something\" (so later `=2` or `=\"a\"` should work)\r\n\r\nHere is where version `2.2.0` is breaking the logic. It maintains the idea of having a \"flexible\" initialization (i.e., does not enforce the former), but then prohibits the (formerly existing) flexibility by raising the latter.\r\n\r\nNow, I'm aware that some might say \"I want both\" (i.e., both be able to declare without type, but maintain hygiene in terms of type casting) - that's what leads to the type cast restriction. What to do? My proposal would be to in fact do both, but manage the edge case: **Allow \"automatic type casting\" only for series where all records are `Nan` or `None` respectively. That covers the edge case.** It would allow pands to automatically initialize a dtype during construction (which is the status quo, and you argued for), but it also allows to maintain the idea of an \"empty dataframe/series\" that can later be filled with \"whatever\" (which is currently possible, too, and that I argue for should be maintained in the future). So if there is data already, you go ahead and raise if a user wants to assign something different. But in the edge case of having absolutely \"nothing\" in the series (and again, assigning `None` leads to `NaN`, so that might represent \"nothing\"), you continue to allow automatic casting.", "A final comment: I don't really agree with your \"recommendation\". It's not so much about relying on pandas to cast properly, but sometimes you may want some flexibility. For example, you might want to incrementally fill a series of `int`, while you still have gaps in there. So in the end, you may or may not end up with a series that can have dtype `int`, or maybe must have type `Int32` or so. \r\n\r\nOf course, you could now say: \"Ok, then define it as `Int` from the start\", but that again is highly non-pythonic. It brings us back to the fundamental thing: \"does pandas require a type definition even at initialization\"? I think just getting started with \"something\" (as python wonderfully allows us to do without defining types) and only in the end running a \"postprocessing\" (-> convert to `Int32` if `NaN` is present, else convert to `int`, some point down the road) is neither particularly risky nor the craziest thing in the world either, IMO.\r\n\r\nThe problem really is that pandas does not have a symbol for \"Nothing\" (unlike python's `None`), but instead sets \"nothing\" to `float` - and then any argument about \"type casting\" becomes quite philosophical.", "> cc @MarcoGorelli\r\n\r\nthanks for the ping. This looks expected to be honest - a Series has to have a dtype, and here the user's setting an incompatible element after initialisation\r\n\r\nI'd suggest just setting the dtype upon initialisation", "This will lead to people setting `ds = pd.Series(None, index=my_index, dtype=object)` - which is far worse than allowing anything to overwrite `NaN` only, no? (by the way not my idea, but the first solution suggested by someone else on stack overflow, even though I agree that `object` would be the most adequate type for \"Nothing\" ;) )", "that's fine, I'd rather have users intentionally shoot themselves in the foot than have pandas do the shooting for them", "> that's fine, I'd rather have users intentionally shoot themselves in the foot than have pandas do the shooting for them\r\n\r\n+1", "Got you. .. However, agree to disagree. If we were talking C++, Fortran (where types MUST be declared), I would agree with the logic \"users have to shoot themselves\". I would say in Python that should not be the case (if user does not declare and sees unexpected behavior, so bet it. types are optional) - especially since that is also how it has been with Pandas until now. And especially since `None` does not even have a type in Pandas. So it feels like you are really introducing a paradigm shift, here. But I see your reasoning, too. Thanks for the discussion. ", "> Thanks for the discussion.\r\n\r\nthank you! closing then" ]
2,137,120,716
57,436
API: Change `assert_index_equal(exact=)` default from `"equiv"` to `True`
open
2024-02-15T17:57:15
2024-02-15T22:35:38
null
https://github.com/pandas-dev/pandas/issues/57436
true
null
null
mroeschke
1
Recently, https://github.com/pandas-dev/pandas/issues/57429 slipped through the cracks because `Index[int64]` is considered equal to `RangeIndex`. While convenient, this allows code changes to potentially introduce a change that leads to increase in memory usage (or decrease in the hopeful case). I don't think this lack of clarity is worth the convenience of making `Index[int64]` equivalent to `RangeIndex` by default and therefore `exact` should default to `True`
[ "Testing", "API Design", "Index" ]
0
0
0
0
0
0
0
0
[ "+1" ]
2,136,829,344
57,435
Unintended behaviour (?) of item "in" Series
closed
2024-02-15T15:30:49
2024-02-15T17:41:32
2024-02-15T17:41:31
https://github.com/pandas-dev/pandas/issues/57435
true
null
null
me9hanics
1
### Pandas version checks - [] 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 mySeries = pd.Series(["a", "b", "c"]) print("a" in mySeries) print("a" in mySeries.tolist()) ``` ### Issue Description The returns: ``` False True ``` When trying to check if a character is in a Pandas series, unlike with general lists, the "in" keyword returns False even when the element is in the series. This is quite unexpected. Of course there are simple workarounds, and I think one could probably explain why this is not a feature, but the False value can be very confusing and it would be better to throw an error. I'm not sure if this is not a Python mistake however (a limitation of the keyword "in" maybe). I did not find this reported among the issues. ### Expected Behavior ```python import pandas as pd mySeries = pd.Series(["a", "b", "c"]) print("a" in mySeries) print("a" in mySeries.tolist()) ``` Results: ``` True True ``` ---or--- Any type of error thrown ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.10.11.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22000 machine : AMD64 processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : Hungarian_Hungary.1250 pandas : 2.2.0 numpy : 1.26.1 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 65.5.0 pip : 23.0.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : 3.1.9 lxml.etree : 5.1.0 html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.2 IPython : 8.17.2 pandas_datareader : None adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : 1.3.7 dataframe-api-compat : None fastparquet : None fsspec : 2023.12.2 gcsfs : None matplotlib : 3.8.2 numba : 0.58.1 numexpr : None odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.4 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : 2.0.1 zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None </details>
[ "Bug", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. This is the intended behavior as documented in https://pandas.pydata.org/docs/user_guide/dsintro.html#series-is-dict-like\r\n\r\nThere is an open issue discussing changing this behavior (I can't find it right now) so closing" ]
2,136,001,641
57,434
DOC: fix SA05 errors in docstrings for `pandas.plotting.bootstrap_plot` and `pandas.plotting.radviz`
closed
2024-02-15T09:09:44
2024-02-16T07:46:38
2024-02-15T17:08:32
https://github.com/pandas-dev/pandas/pull/57434
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57434
https://github.com/pandas-dev/pandas/pull/57434
ooooo-create
1
All SA05 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.plotting.bootstrap_plot 2. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.plotting.radviz 3. try to fix a `RT03 Return value has no description` in pandas.plotting.radviz - [x] xref [DOC: fix SA05 errors in docstrings  #57392](https://github.com/pandas-dev/pandas/issues/57392) - [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
[ "Thanks @ooooo-create " ]
2,135,829,283
57,433
ENH: DF alias for DataFrame
closed
2024-02-15T07:29:15
2024-02-15T17:14:49
2024-02-15T17:14:49
https://github.com/pandas-dev/pandas/issues/57433
true
null
null
lcrmorin
2
### Feature Type - [ ] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description In a very lazy fashion, I was bored from having to write DataFrame everytime. I was wondering if DF could be used as an alias. It would save time when writing and also improve readability. Any toughts on this? ### Feature Description pd.DF() would works exactly like pd.DataFrame() ### Alternative Solutions Create a DF class that inherits for DataFrame? Seems like overkill. ### Additional Context _No response_
[ "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "You do not need pandas to do this for you.\r\n\r\n```python\r\nfrom pandas import DataFrame as DF\r\ndf = DF([[1,2], [3,4]])\r\n```", "Agreed. Thanks for the suggestion but closing" ]
2,135,781,028
57,432
DOC: CoW and column addition
closed
2024-02-15T06:55:29
2024-02-21T22:25:23
2024-02-21T22:25:23
https://github.com/pandas-dev/pandas/issues/57432
true
null
null
JB-AM
4
### 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/getting_started/intro_tutorials/05_add_columns.html ### Documentation problem I’m still grasping at the CoW error message and how to replace the usefull `df['newcolumn'] = process(df['existing_column'])`, as the error message sends to a not so usefull help page (`See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy`, may need a separate ticket, but a simple example using a single index would definitely have helped me. The MultiIndex example clearly hides the message behind unnecessary complexity). But the above mentioned help page (https://pandas.pydata.org/docs/getting_started/intro_tutorials/05_add_columns.html) does not seem to follow the "new good practices" and should probably be updated. ### Suggested fix for documentation I’m not used enough to the new "standard", but the: `air_quality["london_mg_per_cubic"] = air_quality["station_london"] * 1.882` should probably resemble something like: `air_quality[:, "london_mg_per_cubic"] = air_quality["station_london"] * 1.882` and the same for the second example.
[ "Docs", "Needs Info", "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "I believe `df['newcolumn'] = process(df['existing_column'])` should create a new column on `df` with CoW enabled, can you provide a reproducible example?", "A likely point of confusion: `df[mask]['newcolumn'] = some_value` will not update `df` because `df[mask]` is a copy of `df`, and `df[mask]` will get updated instead (and then immediately garbage collected).", "I am very confused by this, we need 2 things here:\r\n\r\n- The warning message that Gets raised (the complete message)\r\n- A complete reproducer, the thing you wrote up should be completely valid, that's why we need something that we can run", "Closing for now. @JB-AM - if you can provide a reproducible example, happy to reopen! Just comment here." ]
2,135,635,766
57,431
Potential perf regressions introduced by Copy-on-Write
open
2024-02-15T04:50:08
2024-03-08T20:47:01
null
https://github.com/pandas-dev/pandas/issues/57431
true
null
null
rhshadrach
9
PR #56633 may have induced a performance regression. If it was a necessary behavior change, this may have been expected and everything is okay. Please check the links below. If any ASVs are parameterized, the combinations of parameters that a regression has been detected for appear as subbullets. - [x] [arithmetic.FrameWithFrameWide.time_op_different_blocks](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks) -> https://github.com/pandas-dev/pandas/pull/57459 - [op=<built-in function floordiv>; shape=(1000000, 10)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20floordiv%3E&p-shape=%281000000%2C%2010%29) - [op=<built-in function gt>; shape=(1000, 10000)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20gt%3E&p-shape=%281000%2C%2010000%29) - [op=<built-in function gt>; shape=(10000, 1000)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20gt%3E&p-shape=%2810000%2C%201000%29) - [op=<built-in function gt>; shape=(100000, 100)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20gt%3E&p-shape=%28100000%2C%20100%29) - [op=<built-in function gt>; shape=(1000000, 10)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20gt%3E&p-shape=%281000000%2C%2010%29) - [ ] [arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0) - [opname='add'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27add%27) - [opname='eq'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27eq%27) - [opname='ge'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27ge%27) - [opname='gt'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27gt%27) - [opname='le'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27le%27) - [opname='lt'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27lt%27) - [opname='mul'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27mul%27) - [opname='ne'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27ne%27) - [opname='sub'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27sub%27) - [opname='truediv'](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.MixedFrameWithSeriesAxis.time_frame_op_with_series_axis0?p-opname=%27truediv%27) - [x] [arithmetic.NumericInferOps.time_add](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_add) (no item_cache overhead) - [dtype=<class 'numpy.int16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_add?p-dtype=%3Cclass%20%27numpy.int16%27%3E) - [dtype=<class 'numpy.int8'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_add?p-dtype=%3Cclass%20%27numpy.int8%27%3E) - [dtype=<class 'numpy.uint16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_add?p-dtype=%3Cclass%20%27numpy.uint16%27%3E) - [dtype=<class 'numpy.uint8'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_add?p-dtype=%3Cclass%20%27numpy.uint8%27%3E) - [x] [arithmetic.NumericInferOps.time_multiply](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_multiply) (no item_cache overhead) - [dtype=<class 'numpy.int16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_multiply?p-dtype=%3Cclass%20%27numpy.int16%27%3E) - [dtype=<class 'numpy.int8'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_multiply?p-dtype=%3Cclass%20%27numpy.int8%27%3E) - [dtype=<class 'numpy.uint16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_multiply?p-dtype=%3Cclass%20%27numpy.uint16%27%3E) - [dtype=<class 'numpy.uint32'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_multiply?p-dtype=%3Cclass%20%27numpy.uint32%27%3E) - [dtype=<class 'numpy.uint8'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_multiply?p-dtype=%3Cclass%20%27numpy.uint8%27%3E) - [x] [arithmetic.NumericInferOps.time_subtract](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_subtract) (no item_cache overhead) - [dtype=<class 'numpy.int16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_subtract?p-dtype=%3Cclass%20%27numpy.int16%27%3E) - [dtype=<class 'numpy.int8'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_subtract?p-dtype=%3Cclass%20%27numpy.int8%27%3E) - [dtype=<class 'numpy.uint16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_subtract?p-dtype=%3Cclass%20%27numpy.uint16%27%3E) - [dtype=<class 'numpy.uint8'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_subtract?p-dtype=%3Cclass%20%27numpy.uint8%27%3E) - [ ] [eval.Eval.time_add](https://asv-runner.github.io/asv-collection/pandas/#eval.Eval.time_add) - [engine='numexpr'; threads='all'](https://asv-runner.github.io/asv-collection/pandas/#eval.Eval.time_add?p-engine=%27numexpr%27&p-threads=%27all%27) - [engine='numexpr'; threads=1](https://asv-runner.github.io/asv-collection/pandas/#eval.Eval.time_add?p-engine=%27numexpr%27&p-threads=1) - [ ] [eval.Eval.time_mult](https://asv-runner.github.io/asv-collection/pandas/#eval.Eval.time_mult) - [engine='numexpr'; threads='all'](https://asv-runner.github.io/asv-collection/pandas/#eval.Eval.time_mult?p-engine=%27numexpr%27&p-threads=%27all%27) - [engine='numexpr'; threads=1](https://asv-runner.github.io/asv-collection/pandas/#eval.Eval.time_mult?p-engine=%27numexpr%27&p-threads=1) - [ ] [frame_ctor.FromNDArray.time_frame_from_ndarray](https://asv-runner.github.io/asv-collection/pandas/#frame_ctor.FromNDArray.time_frame_from_ndarray) - [ ] [frame_methods.Apply.time_apply_axis_1](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Apply.time_apply_axis_1) - [ ] [frame_methods.Apply.time_apply_pass_thru](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Apply.time_apply_pass_thru) - [ ] [frame_methods.AsType.time_astype](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype) - [from_to_dtypes=('Float64', 'float64'); copy=True](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27Float64%27%2C%20%27float64%27%29&p-copy=True) - [from_to_dtypes=('Int64', 'Float64'); copy=False](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27Int64%27%2C%20%27Float64%27%29&p-copy=False) - [from_to_dtypes=('Int64', 'Float64'); copy=True](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27Int64%27%2C%20%27Float64%27%29&p-copy=True) - [from_to_dtypes=('float64', 'Float64'); copy=True](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27float64%27%2C%20%27Float64%27%29&p-copy=True) - [from_to_dtypes=('float64', 'float64[pyarrow]'); copy=True](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27float64%27%2C%20%27float64%5Bpyarrow%5D%27%29&p-copy=True) - [from_to_dtypes=('float64[pyarrow]', 'float64'); copy=True](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27float64%5Bpyarrow%5D%27%2C%20%27float64%27%29&p-copy=True) - [from_to_dtypes=('int64[pyarrow]', 'float64[pyarrow]'); copy=True](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.AsType.time_astype?p-from_to_dtypes=%28%27int64%5Bpyarrow%5D%27%2C%20%27float64%5Bpyarrow%5D%27%29&p-copy=True) - [ ] [frame_methods.Dtypes.time_frame_dtypes](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Dtypes.time_frame_dtypes) - [ ] [frame_methods.Fillna.time_fillna](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Fillna.time_fillna) - [inplace=True; dtype='datetime64[ns, tz]'](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Fillna.time_fillna?p-inplace=True&p-dtype=%27datetime64%5Bns%2C%20tz%5D%27) - [inplace=True; dtype='datetime64[ns]'](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Fillna.time_fillna?p-inplace=True&p-dtype=%27datetime64%5Bns%5D%27) - [inplace=True; dtype='timedelta64[ns]'](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Fillna.time_fillna?p-inplace=True&p-dtype=%27timedelta64%5Bns%5D%27) - [ ] [frame_methods.Iteration.peakmem_itertuples](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Iteration.peakmem_itertuples) - [ ] [frame_methods.Iteration.peakmem_itertuples_raw](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Iteration.peakmem_itertuples_raw) - [ ] [frame_methods.Iteration.peakmem_itertuples_raw_read_first](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Iteration.peakmem_itertuples_raw_read_first) - [ ] [frame_methods.Iteration.peakmem_itertuples_raw_start](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Iteration.peakmem_itertuples_raw_start) - [ ] [frame_methods.Iteration.peakmem_itertuples_start](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Iteration.peakmem_itertuples_start) - [x] [frame_methods.Iteration.time_iteritems_indexing](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.Iteration.time_iteritems_indexing) (no item_cache overhead) - [x] [frame_methods.ToDict.time_to_dict_datetimelike](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToDict.time_to_dict_datetimelike) (no item_cache overhead) - [orient='series'](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToDict.time_to_dict_datetimelike?p-orient=%27series%27) - [x] [frame_methods.ToDict.time_to_dict_ints](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToDict.time_to_dict_ints) - [orient='series'](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToDict.time_to_dict_ints?p-orient=%27series%27) - [x] [frame_methods.ToNumpy.time_to_numpy_tall](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToNumpy.time_to_numpy_tall) - [x] [frame_methods.ToNumpy.time_to_numpy_wide](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToNumpy.time_to_numpy_wide) - [x] [frame_methods.ToNumpy.time_values_tall](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToNumpy.time_values_tall) - [x] [frame_methods.ToNumpy.time_values_wide](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToNumpy.time_values_wide) - [ ] [frame_methods.XS.time_frame_xs](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.XS.time_frame_xs) - [axis=1](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.XS.time_frame_xs?p-axis=1) - [x] [groupby.Fillna.time_srs_bfill](https://asv-runner.github.io/asv-collection/pandas/#groupby.Fillna.time_srs_bfill) - [x] [groupby.Fillna.time_srs_ffill](https://asv-runner.github.io/asv-collection/pandas/#groupby.Fillna.time_srs_ffill) - [ ] [groupby.MultipleCategories.time_groupby_transform](https://asv-runner.github.io/asv-collection/pandas/#groupby.MultipleCategories.time_groupby_transform) - [x] [indexing.Block.time_test](https://asv-runner.github.io/asv-collection/pandas/#indexing.Block.time_test) - [param1=True; param2='np.array(True)'](https://asv-runner.github.io/asv-collection/pandas/#indexing.Block.time_test?p-param1=True&p-param2=%27np.array%28True%29%27) - [param1=True; param2=array(True)](https://asv-runner.github.io/asv-collection/pandas/#indexing.Block.time_test?p-param1=True&p-param2=array%28True%29) - [x] [indexing.DataFrameNumericIndexing.time_loc](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameNumericIndexing.time_loc) - [dtype=<class 'numpy.float64'>; index_structure='nonunique_monotonic_inc'](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameNumericIndexing.time_loc?p-dtype=%3Cclass%20%27numpy.float64%27%3E&p-index_structure=%27nonunique_monotonic_inc%27) - [dtype=<class 'numpy.float64'>; index_structure='unique_monotonic_inc'](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameNumericIndexing.time_loc?p-dtype=%3Cclass%20%27numpy.float64%27%3E&p-index_structure=%27unique_monotonic_inc%27) - [dtype=<class 'numpy.int64'>; index_structure='nonunique_monotonic_inc'](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameNumericIndexing.time_loc?p-dtype=%3Cclass%20%27numpy.int64%27%3E&p-index_structure=%27nonunique_monotonic_inc%27) - [dtype=<class 'numpy.int64'>; index_structure='unique_monotonic_inc'](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameNumericIndexing.time_loc?p-dtype=%3Cclass%20%27numpy.int64%27%3E&p-index_structure=%27unique_monotonic_inc%27) - [dtype=<class 'numpy.uint64'>; index_structure='unique_monotonic_inc'](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameNumericIndexing.time_loc?p-dtype=%3Cclass%20%27numpy.uint64%27%3E&p-index_structure=%27unique_monotonic_inc%27) - [ ] [indexing.DataFrameStringIndexing.time_at](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameStringIndexing.time_at) - [ ] [indexing.DataFrameStringIndexing.time_getitem_scalar](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameStringIndexing.time_getitem_scalar) - [ ] [indexing.DataFrameStringIndexing.time_loc](https://asv-runner.github.io/asv-collection/pandas/#indexing.DataFrameStringIndexing.time_loc) - [ ] [indexing.GetItemSingleColumn.time_frame_getitem_single_column_int](https://asv-runner.github.io/asv-collection/pandas/#indexing.GetItemSingleColumn.time_frame_getitem_single_column_int) - [ ] [indexing.GetItemSingleColumn.time_frame_getitem_single_column_label](https://asv-runner.github.io/asv-collection/pandas/#indexing.GetItemSingleColumn.time_frame_getitem_single_column_label) - [ ] [indexing.SetitemObjectDtype.time_setitem_object_dtype](https://asv-runner.github.io/asv-collection/pandas/#indexing.SetitemObjectDtype.time_setitem_object_dtype) - [x] [reindex.DropDuplicates.time_frame_drop_dups_bool](https://asv-runner.github.io/asv-collection/pandas/#reindex.DropDuplicates.time_frame_drop_dups_bool) - [inplace=False](https://asv-runner.github.io/asv-collection/pandas/#reindex.DropDuplicates.time_frame_drop_dups_bool?p-inplace=False) - [x] [reshape.ReshapeExtensionDtype.time_stack](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeExtensionDtype.time_stack) - [dtype='Period[s]'](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeExtensionDtype.time_stack?p-dtype=%27Period%5Bs%5D%27) - [dtype='datetime64[ns, US/Pacific]'](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeExtensionDtype.time_stack?p-dtype=%27datetime64%5Bns%2C%20US/Pacific%5D%27) - [x] [reshape.ReshapeMaskedArrayDtype.time_stack](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeMaskedArrayDtype.time_stack) - [dtype='Float64'](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeMaskedArrayDtype.time_stack?p-dtype=%27Float64%27) - [dtype='Int64'](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeMaskedArrayDtype.time_stack?p-dtype=%27Int64%27) - [x] [reshape.Unstack.time_full_product](https://asv-runner.github.io/asv-collection/pandas/#reshape.Unstack.time_full_product) -> https://github.com/pandas-dev/pandas/pull/57487 - [param1='int'](https://asv-runner.github.io/asv-collection/pandas/#reshape.Unstack.time_full_product?p-param1=%27int%27) - [x] [reshape.Unstack.time_without_last_row](https://asv-runner.github.io/asv-collection/pandas/#reshape.Unstack.time_without_last_row) - [param1='int'](https://asv-runner.github.io/asv-collection/pandas/#reshape.Unstack.time_without_last_row?p-param1=%27int%27) - [ ] [rolling.EWMMethods.time_ewm](https://asv-runner.github.io/asv-collection/pandas/#rolling.EWMMethods.time_ewm) - [constructor='Series'; kwargs_method=({'halflife': 1000}, 'mean'); dtype='float'](https://asv-runner.github.io/asv-collection/pandas/#rolling.EWMMethods.time_ewm?p-constructor=%27Series%27&p-kwargs_method=%28%7B%27halflife%27:%201000%7D%2C%20%27mean%27%29&p-dtype=%27float%27) - [constructor='Series'; kwargs_method=({'halflife': 1000}, 'mean'); dtype='int'](https://asv-runner.github.io/asv-collection/pandas/#rolling.EWMMethods.time_ewm?p-constructor=%27Series%27&p-kwargs_method=%28%7B%27halflife%27:%201000%7D%2C%20%27mean%27%29&p-dtype=%27int%27) - [constructor='Series'; kwargs_method=({'halflife': 10}, 'mean'); dtype='float'](https://asv-runner.github.io/asv-collection/pandas/#rolling.EWMMethods.time_ewm?p-constructor=%27Series%27&p-kwargs_method=%28%7B%27halflife%27:%2010%7D%2C%20%27mean%27%29&p-dtype=%27float%27) - [constructor='Series'; kwargs_method=({'halflife': 10}, 'mean'); dtype='int'](https://asv-runner.github.io/asv-collection/pandas/#rolling.EWMMethods.time_ewm?p-constructor=%27Series%27&p-kwargs_method=%28%7B%27halflife%27:%2010%7D%2C%20%27mean%27%29&p-dtype=%27int%27) - [ ] [series_methods.Fillna.time_fillna](https://asv-runner.github.io/asv-collection/pandas/#series_methods.Fillna.time_fillna) - [dtype='string'](https://asv-runner.github.io/asv-collection/pandas/#series_methods.Fillna.time_fillna?p-dtype=%27string%27) - [ ] [series_methods.ToNumpy.time_to_numpy](https://asv-runner.github.io/asv-collection/pandas/#series_methods.ToNumpy.time_to_numpy) - [ ] [series_methods.ToNumpy.time_to_numpy_float_with_nan](https://asv-runner.github.io/asv-collection/pandas/#series_methods.ToNumpy.time_to_numpy_float_with_nan) - [ ] [sparse.ToCooFrame.time_to_coo](https://asv-runner.github.io/asv-collection/pandas/#sparse.ToCooFrame.time_to_coo) - [ ] [stat_ops.Correlation.time_corr_series](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.Correlation.time_corr_series) - [method='pearson'](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.Correlation.time_corr_series?p-method=%27pearson%27) - [x] [stat_ops.FrameOps.time_op](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op) -> https://github.com/pandas-dev/pandas/pull/57459 - [op='kurt'; dtype='Int64'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27kurt%27&p-dtype=%27Int64%27&p-axis=0) - [op='kurt'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27kurt%27&p-dtype=%27float%27&p-axis=0) - [op='mean'; dtype='Int64'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27mean%27&p-dtype=%27Int64%27&p-axis=None) - [op='mean'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27mean%27&p-dtype=%27float%27&p-axis=0) - [op='mean'; dtype='float'; axis=1](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27mean%27&p-dtype=%27float%27&p-axis=1) - [op='prod'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27prod%27&p-dtype=%27float%27&p-axis=0) - [op='prod'; dtype='float'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27prod%27&p-dtype=%27float%27&p-axis=None) - [op='sem'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sem%27&p-dtype=%27float%27&p-axis=0) - [op='sem'; dtype='float'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sem%27&p-dtype=%27float%27&p-axis=None) - [op='skew'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27skew%27&p-dtype=%27float%27&p-axis=0) - [op='std'; dtype='Int64'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27std%27&p-dtype=%27Int64%27&p-axis=0) - [op='std'; dtype='Int64'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27std%27&p-dtype=%27Int64%27&p-axis=None) - [op='std'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27std%27&p-dtype=%27float%27&p-axis=0) - [op='std'; dtype='float'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27std%27&p-dtype=%27float%27&p-axis=None) - [op='sum'; dtype='Int64'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sum%27&p-dtype=%27Int64%27&p-axis=0) - [op='sum'; dtype='Int64'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sum%27&p-dtype=%27Int64%27&p-axis=None) - [op='sum'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sum%27&p-dtype=%27float%27&p-axis=0) - [op='sum'; dtype='float'; axis=1](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sum%27&p-dtype=%27float%27&p-axis=1) - [op='sum'; dtype='float'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27sum%27&p-dtype=%27float%27&p-axis=None) - [op='var'; dtype='Int64'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27var%27&p-dtype=%27Int64%27&p-axis=0) - [op='var'; dtype='Int64'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27var%27&p-dtype=%27Int64%27&p-axis=None) - [op='var'; dtype='float'; axis=0](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27var%27&p-dtype=%27float%27&p-axis=0) - [op='var'; dtype='float'; axis=None](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op?p-op=%27var%27&p-dtype=%27float%27&p-axis=None) - [x] [strings.Construction.time_construction](https://asv-runner.github.io/asv-collection/pandas/#strings.Construction.time_construction) (Series constructor now has copy=True by default) - [pd_type='series'; dtype='string[python]'](https://asv-runner.github.io/asv-collection/pandas/#strings.Construction.time_construction?p-pd_type=%27series%27&p-dtype=%27string%5Bpython%5D%27) Subsequent benchmarks may have skipped some commits. The link below lists the commits that are between the two benchmark runs where the regression was identified. [Commit Range](https://github.com/pandas-dev/pandas/compare/c3014abb3bf2e15fa66d194ebd2867161527c497...3b57972ceb49c11198eb0bec6be0006260d48085) cc @phofl
[ "Performance", "Regression", "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[ "Thanks for the list! \r\nI was just planning to look at ASV for CoW today. Investigation of a few of the list:\r\n\r\n[reshape.Unstack.time_full_product](https://asv-runner.github.io/asv-collection/pandas/#reshape.Unstack.time_full_product)\r\n\r\n```\r\nm = 100\r\nn = 1000\r\n\r\nlevels = np.arange(m)\r\nindex = pd.MultiIndex.from_product([levels] * 2)\r\ncolumns = np.arange(n)\r\nvalues = np.arange(m * m * n).reshape(m * m, n)\r\ndf = pd.DataFrame(values, index, columns)\r\n\r\n%timeit df.unstack()\r\n```\r\n\r\nI am using pandas 2.2.0 to easily be able to switch between then default and CoW mode. With that, I can reproduce a slowdown in `unstack`. Profiling this with CoW enabled, this seems to be caused by a slower DataFrame construction of the final result in `Unstacker.get_result`. I _assume_ this is because of the DataFrame constructor now copying an input numpy array, and in this case we can pass `copy=False` as we know we created the new `values` ourselves:\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/f538741432edf55c6b9fb5d0d496d2dd1d7c2457/pandas/core/reshape/reshape.py#L242-L244\r\n\r\n[arithmetic.FrameWithFrameWide.time_op_different_blocks op=; shape=(1000000, 10)](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.FrameWithFrameWide.time_op_different_blocks?p-op=%3Cbuilt-in%20function%20floordiv%3E&p-shape=%281000000%2C%2010%29)\r\n\r\n```\r\nn_rows, n_cols = 1_000_000, 10\r\n\r\n# construct dataframe with 2 blocks\r\narr1 = np.random.randn(n_rows, n_cols // 2).astype(\"f8\")\r\narr2 = np.random.randn(n_rows, n_cols // 2).astype(\"f4\")\r\ndf = pd.concat([DataFrame(arr1), DataFrame(arr2)], axis=1, ignore_index=True)\r\ndf._consolidate_inplace()\r\n\r\narr1 = np.random.randn(n_rows, max(n_cols // 4, 3)).astype(\"f8\")\r\narr2 = np.random.randn(n_rows, n_cols // 2).astype(\"i8\")\r\narr3 = np.random.randn(n_rows, n_cols // 4).astype(\"f8\")\r\ndf2 = pd.concat(\r\n [DataFrame(arr1), DataFrame(arr2), DataFrame(arr3)],\r\n axis=1,\r\n ignore_index=True,\r\n)\r\ndf2._consolidate_inplace()\r\n\r\n%timeit df > df2\r\n```\r\n\r\nThis I can also reproduce, and a profile indicates the slowdown comes entirely from the actual `>` operation on the underlying data. So the one difference seems to be that with CoW, the underlying block values seem to be row major (column major in the transposed Block.values), while without CoW it's the expected column major layout.\r\nSimpler example:\r\n\r\n```\r\n>>> pd.options.mode.copy_on_write = False\r\n>>> arr = np.random.randn(n_rows, n_cols)\r\n>>> df = pd.concat([pd.DataFrame(arr), pd.DataFrame(arr)], axis=1, ignore_index=True)\r\n>>> df._mgr.blocks[0].values.shape\r\n(10, 1000000)\r\n>>> df._mgr.blocks[0].values.flags\r\n C_CONTIGUOUS : True\r\n F_CONTIGUOUS : False\r\n OWNDATA : False\r\n WRITEABLE : True\r\n ALIGNED : True\r\n WRITEBACKIFCOPY : False\r\n\r\n>>> pd.options.mode.copy_on_write = True\r\n>>> df = pd.concat([pd.DataFrame(arr), pd.DataFrame(arr)], axis=1, ignore_index=True)\r\n>>> df._mgr.blocks[0].values.flags\r\n C_CONTIGUOUS : False\r\n F_CONTIGUOUS : True\r\n OWNDATA : False\r\n WRITEABLE : True\r\n ALIGNED : True\r\n WRITEBACKIFCOPY : False\r\n```\r\n\r\nSo something seems to go wrong in the DataFrame constructor. With CoW enabled, this should make a copy by default, but when making this copy, it seems to not use the correct C vs F order.\r\n\r\n[series_methods.ToNumpy.time_to_numpy](https://asv-runner.github.io/asv-collection/pandas/#series_methods.ToNumpy.time_to_numpy)\r\n\r\n```\r\nN = 1_000_000\r\nser = pd.Series(np.random.randn(N,))\r\n\r\n%timeit ser.to_numpy()\r\n```\r\n\r\ngives\r\n```\r\nIn [80]: %timeit ser.to_numpy()\r\n846 ns ± 57.3 ns per loop (mean ± std. dev. of 7 runs, 1,000,000 loops each) # witout CoW\r\n2.38 µs ± 10.7 ns per loop (mean ± std. dev. of 7 runs, 100,000 loops each) # with CoW\r\n```\r\n\r\nIn this case there _is_ some extra work being done to return a read-only view:\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/f538741432edf55c6b9fb5d0d496d2dd1d7c2457/pandas/core/base.py#L667-L669\r\n\r\nSo it might be this is just that (but haven't checked in detail, from a quick profile nothing stood really out apart from just the body of `to_numpy` taking a bit longer)", "Starting a list here what is a false-positive/expected:\r\n\r\n- [time_to_dict_datetimelike](https://asv-runner.github.io/asv-collection/pandas/#frame_methods.ToDict.time_to_dict_datetimelike)\r\n\r\nboth to_dict cases are only as fast because of the item_cache which is something we removed, so nothing we can do\r\n\r\n- time_iteritems_indexing\r\n\r\nalso item_cache, iterating over the columns once is actually twice as fast now, but doing it repeatedly scales linearly now, but this is expected\r\n\r\n\r\n- [groupby.Fillna.time_srs_bfill](https://asv-runner.github.io/asv-collection/pandas/#groupby.Fillna.time_srs_bfill) and fill actually are faster now if you increase the objects, the actual object is tiny, so it's probably the constant cost caused the increase (we are 20% faster if we create an object that runs around 100ms)\r\n\r\n- time_loc scales well, it's only on small dfs that we see the slowdown", "For the several `time_stack` ones (eg [reshape.ReshapeMaskedArrayDtype.time_stack - dtype='Float64'](https://asv-runner.github.io/asv-collection/pandas/#reshape.ReshapeMaskedArrayDtype.time_stack?p-dtype=%27Float64%27)), it seems that the CoW PR only gave a small perf regression (which I think is again due to the item cache being gone), but those benchmarks show a much bigger slowdown some commits later (I see @rhshadrach and @DeaMariaLeon were discussing those yesterday on slack). \r\nGiven that those are not related to CoW, marking them as \"done\" in the top post here.\r\n", "For the various [arithmetic.NumericInferOps.time_add - dtype=<class 'numpy.int16'>](https://asv-runner.github.io/asv-collection/pandas/#arithmetic.NumericInferOps.time_add?p-dtype=%3Cclass%20%27numpy.int16%27%3E) cases (also for `time_multiply` and `time_subtract`, I assume): the small slowdown is also due to the item_cache removal. \r\nAnd the fact that we only see it for the lower bitwidth dtypes, is because it seems the actual addition operation for those is much faster, and so the overhead of getting the column becomes relatively bigger, making this noticeable in the benchmark. \r\nMarked those as \"done\".", "For [strings.Construction.time_construction](https://asv-runner.github.io/asv-collection/pandas/#strings.Construction.time_construction), the reason of the slowdown is that `Series(nparr)` now by default makes a copy, so that is expected (without the benchmark using `copy=False`)", "[stat_ops.FrameOps.time_op](https://asv-runner.github.io/asv-collection/pandas/#stat_ops.FrameOps.time_op)\r\n\r\n```python\r\ndtype = \"float\"\r\naxis = 0\r\nvalues = np.random.randn(100000, 4)\r\ndf = pd.DataFrame(values).astype(dtype)\r\n\r\n%timeit df.sum(axis=axis)\r\n```\r\n\r\nThis was also because of the constructor copying the array but not creating the correct columnar layout, and so this should be fixed on main with https://github.com/pandas-dev/pandas/pull/57459 (confirmed locally, in a few days we should also see this on the ASV results)", "[series_methods.Fillna.time_fillna - dtype='string'](https://asv-runner.github.io/asv-collection/pandas/#series_methods.Fillna.time_fillna?p-dtype=%27string%27)\r\n\r\n```python\r\ndtype = \"string\"\r\nN = 10**6\r\ndata = np.array([str(i) * 5 for i in range(N)], dtype=object)\r\nna_value = pd.NA\r\nfill_value = data[0]\r\nser = pd.Series(data, dtype=dtype)\r\nser[::2] = na_value\r\n\r\n%timeit ser.fillna(fill_value)\r\n```\r\n\r\nThis is a slowdown that I can reproduce, and is due to the additional `hasna` check that we added (linking to the 2.2 code, so its clearer what is run in case of CoW vs before):\r\n\r\nhttps://github.com/pandas-dev/pandas/blob/3cc5afa53e123a89e594df87630f9ac61e718a09/pandas/core/internals/blocks.py#L2321-L2329\r\n\r\nSo for CoW, we added the additional check to see if there are actually NAs to fill, and if not just return the original values + the correct refs. \r\nBut for the case where we are actually filling NAs, it seems this `_hasna` check gives a significant overhead (around 30% in this example, and at least for string dtype, since that's the only dtype that shows a regression in the ASV results)\r\n\r\nNow, that is also only for our own object-dtype string dtype, so given we have pyarrow-backed strings as a faster alternative if you care about performance, this is probably an OK trade-off (since the `hasna` check gives other benefits, like avoiding a copy if no NAs)", "Although after taking a quick look at `isna` for strings, it's also easy to speed it up, to offset the additional overhead a bit -> https://github.com/pandas-dev/pandas/pull/57733", "I've looked through the most recent benchmarks, confirmed https://github.com/pandas-dev/pandas/issues/57431#issuecomment-1978212744, and checked off the box." ]
2,135,550,078
57,430
TYP: misc return types
closed
2024-02-15T03:05:12
2024-04-07T10:59:20
2024-02-16T17:23:10
https://github.com/pandas-dev/pandas/pull/57430
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57430
https://github.com/pandas-dev/pandas/pull/57430
twoertwein
1
null
[ "Typing" ]
0
0
0
0
0
0
0
0
[ "Thanks @twoertwein " ]
2,135,470,504
57,429
BUG: read_json(line=True) returns `Index` instead of `RangeIndex` in 2.2
closed
2024-02-15T01:30:18
2024-02-21T19:41:05
2024-02-21T19:41:05
https://github.com/pandas-dev/pandas/issues/57429
true
null
null
mroeschke
1
```python In [2]: import pandas as pd; from io import StringIO In [3]: data = """\ ...: {"a": 1, "b": 2} ...: {"a": 3, "b": 4}""" In [4]: pd.read_json(StringIO(data), lines=True).index Out[4]: Index([0, 1], dtype='int64'). # main Out[3]: RangeIndex(start=0, stop=2, step=1). # 2.1 ```
[ "Regression", "IO JSON" ]
0
0
0
0
0
0
0
0
[ "In Line 1163: Index object is explicitly created (which I commented out and used the existing index of newly generated series)\r\n\r\n![image](https://github.com/pandas-dev/pandas/assets/16797137/cb63c38e-8435-410a-a07d-b1cd729ed62b)\r\n\r\nAfter changes:\r\n\r\n```python3\r\ndata = \"\"\"\r\n{\"a\": 1, \"b\": 2}\r\n{\"a\": 3, \"b\": 4}\r\n\"\"\"\r\n\r\nprint(pd.read_json(StringIO(data), lines=True).index)\r\n```\r\n\r\ngives me expected results:\r\n\r\n```\r\n[1/1] Generating write_version_file with a custom command\r\nIntervalIndex([ (1.0, 2.0), (2.0, 3.0), (3.0, 4.0), (4.0, 5.0), (5.0, 6.0),\r\n (6.0, 7.0), (7.0, 8.0), (8.0, 9.0), (9.0, 10.0)],\r\n dtype='interval[float32, neither]')\r\nRangeIndex(start=0, stop=2, step=1)\r\n```" ]
2,135,207,324
57,428
CLN: Remove inf_as_na
closed
2024-02-14T21:08:18
2024-02-19T23:28:27
2024-02-19T23:28:25
https://github.com/pandas-dev/pandas/pull/57428
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57428
https://github.com/pandas-dev/pandas/pull/57428
mroeschke
1
xref https://github.com/pandas-dev/pandas/pull/53494
[ "Clean" ]
0
0
0
0
0
0
0
0
[ "Going to merge this one. Happy to follow up" ]
2,135,140,513
57,427
BUG: Resampling with non nano returns an error
open
2024-02-14T20:22:14
2025-06-02T17:12:47
null
https://github.com/pandas-dev/pandas/issues/57427
true
null
null
khider
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. - [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 numpy as np import operator #Load the data url = 'https://raw.githubusercontent.com/LinkedEarth/Pyleoclim_util/master/pyleoclim/data/LR04.csv' df = pd.read_csv(url,skiprows=4,header=0) multiplier = 1 rule = f'{1_000*multiplier}YS' op=operator.sub SECONDS_PER_YEAR = 31556925.974592 index = pd.DatetimeIndex(op( np.datetime64(str(1950), 's'), (df.iloc[:,0]*SECONDS_PER_YEAR*10**3).astype('timedelta64[s]') ),name='datetime') value = df.iloc[:,1].to_numpy() ser = pd.Series(value, index=index) ser2 = ser.resample(rule) ``` ### Issue Description Produces the following error: ``` Traceback (most recent call last): Cell In[13], line 1 ser2 = ser.resample(rule) File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/generic.py:9765 in resample return get_resampler( File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/resample.py:2044 in get_resampler return tg._get_resampler(obj, kind=kind) File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/resample.py:2225 in _get_resampler return DatetimeIndexResampler( File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/resample.py:187 in __init__ self.binner, self._grouper = self._get_binner() File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/resample.py:252 in _get_binner binner, bins, binlabels = self._get_binner_for_time() File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/resample.py:1735 in _get_binner_for_time return self._timegrouper._get_time_bins(self.ax) File ~/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/pandas/core/resample.py:2323 in _get_time_bins bins = lib.generate_bins_dt64( File lib.pyx:891 in pandas._libs.lib.generate_bins_dt64 ValueError: Values falls before first bin ``` Note that this issue did not exist in 2.1.4 ### Expected Behavior A resampled timeseries as of 2.1.4 ### Installed Versions <details> pd.show_versions() /Users/deborahkhider/opt/anaconda3/envs/paleopandas/lib/python3.10/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.10.8.final.0 python-bits : 64 OS : Darwin OS-release : 22.6.0 Version : Darwin Kernel Version 22.6.0: Wed Jul 5 22:21:56 PDT 2023; root:xnu-8796.141.3~6/RELEASE_X86_64 machine : x86_64 processor : i386 byteorder : little LC_ALL : en_US.UTF-8 LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.24.3 pytz : 2023.3 dateutil : 2.8.2 setuptools : 67.7.2 pip : 23.1.2 Cython : 0.29.33 pytest : None hypothesis : None sphinx : 5.0.2 blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.2 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 : 4.12.2 bottleneck : 1.3.6 dataframe-api-compat : None fastparquet : None fsspec : 2023.6.0 gcsfs : None matplotlib : 3.6.3 numba : 0.57.0 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.12.0 sqlalchemy : 2.0.23 tables : None tabulate : 0.9.0 xarray : 2023.1.0 xlrd : 2.0.1 zstandard : None tzdata : 2023.3 qtpy : 2.3.1 pyqt5 : None </details>
[ "Bug", "Regression", "Resample", "Non-Nano" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report, I am seeing this also fail on 2.1.4 - can you check that again and post the `pd.show_versions()` of the 2.1.4 environment you're seeing it succeed in?\r\n\r\nAlso - I'm seeing this:\r\n\r\n```\r\nprint(ser.index)\r\n# DatetimeIndex(['-5298046-05-16 11:11:03', '-5303046-05-17 11:19:50',\r\n# '-5308046-05-19 11:28:37', '-5313046-05-20 11:37:24',\r\n# '-5318046-05-22 11:46:11'],\r\n# dtype='datetime64[s]', name='datetime', freq=None)\r\n```\r\n\r\nare those the desired values?", "Confirming that it works for me with 2.1.4 on two different Mac machines. \r\n\r\nThis is from the second machine:\r\n```\r\npd.show_versions()\r\n/Users/deborahkhider/anaconda3/envs/paleodev/lib/python3.11/site-packages/_distutils_hack/__init__.py:33: UserWarning: Setuptools is replacing distutils.\r\n warnings.warn(\"Setuptools is replacing distutils.\")\r\n\r\nINSTALLED VERSIONS\r\n------------------\r\ncommit : a671b5a8bf5dd13fb19f0e88edc679bc9e15c673\r\npython : 3.11.7.final.0\r\npython-bits : 64\r\nOS : Darwin\r\nOS-release : 23.3.0\r\nVersion : Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:59 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6030\r\nmachine : arm64\r\nprocessor : arm\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.1.4\r\nnumpy : 1.26.3\r\npytz : 2023.3.post1\r\ndateutil : 2.8.2\r\nsetuptools : 68.2.2\r\npip : 23.3.1\r\nCython : None\r\npytest : 8.0.0\r\nhypothesis : None\r\nsphinx : 5.0.2\r\nblosc : None\r\nfeather : None\r\nxlsxwriter : None\r\nlxml.etree : None\r\nhtml5lib : None\r\npymysql : None\r\npsycopg2 : None\r\njinja2 : 3.1.2\r\nIPython : 8.20.0\r\npandas_datareader : None\r\nbs4 : 4.12.2\r\nbottleneck : None\r\ndataframe-api-compat: None\r\nfastparquet : None\r\nfsspec : None\r\ngcsfs : None\r\nmatplotlib : 3.8.2\r\nnumba : 0.58.1\r\nnumexpr : None\r\nodfpy : None\r\nopenpyxl : None\r\npandas_gbq : None\r\npyarrow : 15.0.0\r\npyreadstat : None\r\npyxlsb : None\r\ns3fs : None\r\nscipy : 1.12.0\r\nsqlalchemy : None\r\ntables : None\r\ntabulate : 0.9.0\r\nxarray : None\r\nxlrd : 2.0.1\r\nzstandard : None\r\ntzdata : 2023.4\r\nqtpy : 2.4.1\r\npyqt5 : None\r\n```\r\n\r\nAlso, I recreated this function from the documentation of another code base that is now compiling fine on readthedocs. \r\n\r\nYes. these are the expected values. " ]
2,135,111,191
57,426
DOC: fix SA05 errors in docstrings for pandas.core.resample.Resampler…
closed
2024-02-14T20:03:03
2024-02-14T21:25:17
2024-02-14T21:13:40
https://github.com/pandas-dev/pandas/pull/57426
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57426
https://github.com/pandas-dev/pandas/pull/57426
williamking1221
1
Small code change, removing the two functions above for SA05 ignore functions. - [ ] xref #57392 - [ ] [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 @williamking1221 " ]
2,135,075,531
57,425
CLN: shift with freq and fill_value, to_pydatetime returning Series
closed
2024-02-14T19:41:30
2024-02-27T17:45:37
2024-02-20T01:21:52
https://github.com/pandas-dev/pandas/pull/57425
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57425
https://github.com/pandas-dev/pandas/pull/57425
mroeschke
2
xref https://github.com/pandas-dev/pandas/pull/52459, https://github.com/pandas-dev/pandas/pull/54818
[ "Clean" ]
0
0
0
0
0
0
0
0
[ "Going to merge this one. Can follow up if needed", "> Going to merge this one. Can follow up if needed\r\n\r\nI am opening a PR #57469 to add future warning when calling ```to_pytimedelta``` function, but here it seems that you changed the return type to Series and removed all warning-related imports. Do you want me to do the same thing for ```to_pytimedelta```? " ]
2,135,034,332
57,424
VOTE: Core Team Vote on Keeping/Removing pyarrow warning
closed
2024-02-14T19:20:27
2024-05-31T22:07:52
2024-05-31T22:07:52
https://github.com/pandas-dev/pandas/issues/57424
true
null
null
Dr-Irv
26
@pandas-dev/pandas-core At the development meeting on February 14, we agreed to take a vote on whether to remove the `DeprecationWarning` about `pyarrow` being required in version 2.2.1. We agreed that the decision about whether `pyarrow` will still be required with version 3.0 is delayed. Core team should vote below on one of these 2 options: OPTION 1: Keep the `DeprecationWarning` in Version 2.2.1 OPTION 2: Remove the `DeprecationWarning` in Version 2.2.1 OPTION 3: Indifferent (equivalent to a +0 on up/down vote issues) Voting will close at Noon Eastern Time on February 20, 2024. In the comments, choose OPTION 1 or OPTION 2 or OPTION 3. The decision will be based on which option receives the most votes. If OPTION 3 receives the most votes, then either OPTION 1 or OPTION 2 will be chosen based on which has the most votes. If both of those receive the same number of votes, I don't know what we will do! For reference: Current warning that users see when importing pandas in version 2.2.0: ```text 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, please provide us feedback at https://github.com/pandas-dev/pandas/issues/54466 ``` Github issue with feedback: https://github.com/pandas-dev/pandas/issues/54466 Github issue with discussion about not requiring `pyarrow`: https://github.com/pandas-dev/pandas/issues/57073 I'll list the reasons for keeping/removing the warning here, based on my recall of the discussion. Others can feel free to add additional reasons in the comments, or correct my memory. Reasons for keeping the warning: - pandas 2.2.0 has only been out for 1 month, so we may obtain more feedback, as many people may have not upgraded yet - There may be additional reasons for not requiring `pyarrow` that we have not considered - If we remove the warning, then users might infer that we have decided to not require `pyarrow` in version 3.0 Reasons for removing the warning: - Too many people who are not affected by requring `pyarrow` are confused by the warning - We have enough feedback already to make a decision - It's too noisy for a variety of use cases
[ "Vote" ]
0
0
0
0
0
0
0
0
[ "Option 2", "2, I think enough feedback has been collected", "Option 1", "Option 1", "Option 2\r\n\r\n(Side Note: I'm not sure the size and capabilities of pyarrow-core and whether Option 1 with an updated message about the dependency would change the feedback received)", "Option 1, keep the warning", "Option 2", "Option 2", "Option 1, retain the warning. ", "Option 2", "Option 3\r\n\r\n(it's an annoying warning but also a major change~~and `DeprecationWarning` are not printed by default~~)", "Option 1\n\npeople complain about everything - it's a good warning and useful", "Option 1.\r\nIts annoying and I think it should be removed for the final 2.2.x release but for now its only been out for 1 month so keep it.", "~Option 2\r\nLots of users are affected by the warning, no matter whether they directly rely on pandas or not. I don't think it's end side user's responsibility to depress these warnings.~\r\n\r\nEdit (@phofl): This is a core team vote, so please refrain from commenting here", "Option 1", "Option 1", "Option 2", "@twoertwein\r\n\r\n> (it's an annoying warning but also a major change and DeprecationWarning are not printed by default)\r\n\r\nNot trying to sway anyone's vote, but I do think it's important to know that this is not always true. It will print if you run `python foo.py` and `foo.py` imports pandas directly prior to importing any other module that imports pandas. Likewise, it will print when you import pandas directly in a jupyter notebook - again only if prior to importing any other module that imports pandas.\r\n\r\nIf you first import another module that imports pandas, you will not see the warning by default.", "You are right! (For some reason, I get a different `DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated ` on python 3.12 only when changing the warning level).\r\n\r\nThis is probably not the place for a new option, but changing it to an `ImportWarning` (which is not printed by default) might be a nice middle ground.\r\n\r\nI changed my vote to \"Option 3\" (indifferent). Option 2 doesn't make sense to me as a large percentage of \"users\" (downloads) is not yet using 2.2: https://www.pepy.tech/projects/pandas", "Option 2", "Option 2\r\n\r\nconditional on backing out making pyarrow required as per PDEP 10. ", "\r\n> Option 2\r\n> \r\n> conditional on backing out making pyarrow required as per PDEP 10.\r\n\r\n@lithomas1 are you saying that you only support option 2 if pyarrow is no longer required? But given that we have not yet decided whether to reverse PDEP-10, does that change your vote?\r\n", "The final tally is\r\n- Option 1: 8\r\n- Option 2: 9\r\n- Option 3: 1\r\n\r\nSince I did say this would be a majority vote, we should remove the warning for 2.2.1.\r\n\r\nHaving said that, @jorisvandenbossche and I have discussed that we really don't have a process for revoking parts of a PDEP. In other words, PDEP-10 says a warning would be issued from 2.2 onwards. By removing the warning, we are changing the outcome of the PDEP via an ad-hoc voting process created to resolve this particular issue. So I'm not entirely comfortable with making this decision based on a difference of 1 vote. I'm not sure how others feel about the procedural aspect of this decision, where a simple majority determines the revocation of part of a PDEP.\r\n\r\n", "I'll make the PR to remove the warning. I didn't have time yesterday, so will put off the release until Friday.", "This'll also give us some time to think through this decision some more, in case people are getting worried about the simple majority thing.\r\n\r\nCan someone else update the PDEP?", "Closing since this already happened" ]
2,134,994,966
57,423
PERF: python 3.11 => 3.12 perf regression with .agg(','.join)
closed
2024-02-14T19:00:12
2024-02-14T22:23:02
2024-02-14T22:19:35
https://github.com/pandas-dev/pandas/issues/57423
true
null
null
kartiksubbarao
1
### Pandas version checks - [X] I have checked that this issue has not already been reported. - [X] I have confirmed this issue exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas. - [ ] I have confirmed this issue exists on the main branch of pandas. ### Reproducible Example ```python import numpy as np import pandas as pd import timeit dates = np.repeat(pd.date_range(start="2021-01-01", end="2023-12-31"), 1000) data = { 'x': ['X'] * len(dates) } df = pd.DataFrame(data, index=dates) df.index.name = 'date' print(timeit.timeit('df.x.groupby("date").agg(",".join)', globals=globals(), number=100)) ``` In Python 3.11, this script runs in 5.6 seconds, whereas in Python 3.12 it takes 8.6 seconds (identical, current versions of pandas and numpy). Here are the profiles of both runs: * Python 3.11: [perf311.txt](https://github.com/pandas-dev/pandas/files/14284864/perf311.txt) * Python 3.12: [perf312.txt](https://github.com/pandas-dev/pandas/files/14284869/perf312.txt) I also ran these one-liners to check the raw performance of Python 3.11 and 3.12: ``` % python3.11 -m timeit "','.join(['X' for _ in range(500000000)])" 1 loop, best of 5: 6.33 sec per loop % python3.12 -m timeit "','.join(['X' for _ in range(500000000)])" 1 loop, best of 5: 7.27 sec per loop ``` **UPDATE**: I ran another set of one-liners which _doesn't_ seem to show any performance difference at the python level: ``` % python3.11 -m timeit "','.join(['X'] * 500000000)" 1 loop, best of 5: 2.6 sec per loop % python3.12 -m timeit "','.join(['X'] * 500000000)" 1 loop, best of 5: 2.6 sec per loop ``` There seems to be a 15% slowdown here with the first one-liner, no difference with the second one-liner, and a 50% slowdown with the pandas script. It's unclear to me which of the one-liners is more along the lines of what pandas is invoking. Overall, I'm not sure how much of this is Python itself and how much is Pandas, I'm hoping someone here can help troubleshoot this further. Also, if anyone has suggestions for workarounds that'd be greatly appreciated. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.12.1.final.0 python-bits : 64 OS : Linux OS-release : 6.7.4-200.fc39.x86_64 Version : #1 SMP PREEMPT_DYNAMIC Mon Feb 5 22:21:14 UTC 2024 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.26.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 24.0 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 5.1.0 html5lib : 1.1 pymysql : None psycopg2 : None jinja2 : None IPython : 8.21.0 pandas_datareader : 0.10.0 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 : 0.59.0 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 : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details> ### Prior Performance _No response_
[ "Performance", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "Upgrading from Python 3.12.1 to 3.12.2 resolved this issue for me: https://github.com/python/cpython/issues/115487" ]
2,134,889,836
57,422
ENH: Preserve Series index on `json_normalize`
closed
2024-02-14T18:06:34
2024-02-14T22:27:33
2024-02-14T21:12:56
https://github.com/pandas-dev/pandas/pull/57422
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57422
https://github.com/pandas-dev/pandas/pull/57422
nworb-cire
4
- [ ] closes #51452 - [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. Passing a Series as input to `json_normalize` was already functional before but undocumented as a feature, and had the issue linked above where it would not preserve the index of the input series.
[ "IO JSON" ]
0
0
0
0
0
0
0
0
[ "Thanks @nworb-cire ", "Hi @mroeschke @nworb-cire, I just saw this via email that the original issue had been closed. (@nworb-cire thanks for the fix!).\r\n\r\nThe code looks valid and follows the principle-of-least-surprise that the index is retained when `json_normalize` input is a series.\r\n\r\nHowever, that is a breaking change on existing pandas code in the wild that might rely on json_normalise always returning a fresh 0:N index.\r\n\r\nI think the **patch notes should alert to the change in behaviour more strongly than it currently does**. \r\n\r\n@mroeschke I assume that the breaking change is okay as part of pandas 3.0? If pandas guidelines are not okay with breaking changes we could patch in an extra arg for the function such that the default behaviour is the former (weird) behaviour but users can toggle on the new functionality.", "> I assume that the breaking change is okay as part of pandas 3.0?\r\n\r\nCorrect. I am not sure if adding an extra argument to get the old behavior is entirely needed as a user can get the old behavior by calling `reset_index` before using `json_normalize`, but a doc example showing that would be welcome.", "> I am not sure if adding an extra argument to get the old behavior is entirely needed as a user can get the old behavior by calling reset_index before using json_normalize,\r\n\r\nThe only reason to add the extra arg would be to make the code backwards compatible. If we are happy to make a breaking change then there is no need for it." ]
2,134,843,274
57,421
BUG: Subsetting a df can sometimes change pandas behaviour into thinking the removed values still exists
closed
2024-02-14T17:35:29
2024-02-24T11:16:04
2024-02-14T17:47:21
https://github.com/pandas-dev/pandas/issues/57421
true
null
null
Chuck321123
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. - [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 numpy as np # Create random data data = {"Group": ["A"] * 3 + ["B"] * 3 + ["C"] * 3, "Value": [1, 2, 3, 4, 5, 6, 7, 8, 9]} # Create DataFrame df = pd.DataFrame(data) # Change dtype to category df["Group"] = df["Group"].astype("category") # Filter away C group df = df[df["Group"] != "B"] # Find the group lengths Group_Lengths = df.groupby('Group').size().reset_index() print(Group_Lengths) ``` ### Issue Description So this is a weird bug. If you remove a group value from a df and the dtype fo the column is a categorical one, the group length will still show as if it still was there. ![image](https://github.com/pandas-dev/pandas/assets/123987501/cec5a274-a908-4864-8521-a5cdb3584973) The line in the middle shouldnt really exist ### Expected Behavior That "B" doesnt show up in the group lengths ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 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 142 Stepping 9, GenuineIntel byteorder : little LC_ALL : None LANG : en LOCALE : Norwegian Bokmål_Norway.1252 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 : 5.0.2 blosc : None feather : None xlsxwriter : None lxml.etree : None 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.8.2 numba : 0.59.0 numexpr : None odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : 14.0.2 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.4 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None zstandard : 0.19.0 tzdata : 2023.4 qtpy : 2.4.1 pyqt5 : None </details>
[ "Bug", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report, but you can use `.cat.remove_unused_categories` https://pandas.pydata.org/docs/reference/api/pandas.Series.cat.remove_unused_categories.html", "@mroeschke Yes, i saw your comment as i updated my comment. That is also a solution", "You can also use `observed=True` in groupby. This will become the default in pandas 3.0." ]
2,134,834,575
57,420
DOC: fix PR07 errors in docstrings
closed
2024-02-14T17:29:46
2024-03-29T06:47:02
2024-03-18T02:00:40
https://github.com/pandas-dev/pandas/issues/57420
true
null
null
jordan-d-murphy
7
Pandas has a script for validating docstrings: Currently, some methods fail the PR07 check. https://github.com/pandas-dev/pandas/blob/5fff2cd4818514a2d217e4202e1d78de2290c207/ci/code_checks.sh#L144-L258 The task here is: - take 2-4 methods - run: scripts/validate_docstrings.py --format=actions --errors=PR07 `method-name` - check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported - remove those methods from code_checks.sh - commit, push, open pull request Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels:\r\n\r\n- CI\r\n- Docs\r\n- good first issue", "Addresses https://github.com/pandas-dev/pandas/pull/57357", "opened a fix for `pandas.DataFrame.align`", "opening a fix for \r\n\r\n```\r\npandas.DataFrame.get\r\npandas.DataFrame.rolling\r\npandas.DataFrame.to_hdf\r\n```", "Hi all, if [CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826) gets merged in, I might be reworking our approach here; this would look like closing the following issues: \r\n\r\n\r\n> [DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)\r\n> [DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n> [DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n> [DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n> [DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n> [DOC: fix PR02 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57111)\r\n\r\nAnd opening a new issue to address these based on the new approach. \r\n\r\ntl;dr \r\n\r\nthe work can still be done, but probably under a new ticket once #57826 is merged in", "Closed by:\r\n[CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826)\r\n[CI: Better error control in the validation of docstrings #57879](https://github.com/pandas-dev/pandas/pull/57879) \r\n\r\nOpening a new issue to fix docstring errors. ", "Opened [DOC: Enforce Numpy Docstring Validation (Parent Issue) #58063](https://github.com/pandas-dev/pandas/issues/58063) as a parent issue for fixing docstrings based on the refactoring in code_checks.sh \r\n\r\nFeel free to swing by and help out! 🙂" ]
2,134,414,318
57,419
DOC: Add example for DataFrame.pow
closed
2024-02-14T13:57:29
2024-02-19T23:38:31
2024-02-19T23:38:31
https://github.com/pandas-dev/pandas/issues/57419
true
null
null
datapythonista
0
The API documentation of [DataFrame.pow](https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.pow.html) seems to be reused with many other arithmetic operations, and it contains examples for all or most of the others, but not for `pow`. For someone checking the page this is confusing, it'd be nice to add it.
[ "Docs", "Numeric Operations", "good first issue" ]
0
0
0
0
0
0
0
0
[]
2,133,982,070
57,418
BUG: conversion from Int64 to string introduces decimals in Pandas 2.2.0
closed
2024-02-14T10:10:11
2024-02-20T17:26:54
2024-02-20T17:26:54
https://github.com/pandas-dev/pandas/issues/57418
true
null
null
mplatzer
7
### 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 pd.Series([12, pd.NA], dtype="Int64[pyarrow]").astype("string[pyarrow]") ``` yields ``` 0 12.0 1 <NA> dtype: string ``` ### Issue Description Converting from Int64[pyarrow] to string[pyarrow] introduces float notation, if NAs are present. I.e. `12` will be converted to `"12.0"`. This bug got introduced in Pandas 2.2.0, is still present on Pandas 2.2.x branch, but is not present on Pandas main branch. ### Expected Behavior import pandas as pd x = pd.Series([12, pd.NA], dtype="Int64[pyarrow]").astype("string[pyarrow]") assert x[0] == "12" ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.7.final.0 python-bits : 64 OS : Darwin OS-release : 23.2.0 Version : Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 machine : arm64 processor : arm byteorder : little LC_ALL : None LANG : None LOCALE : None.UTF-8 pandas : 2.2.0 numpy : 1.26.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 24.0 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 : 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 : 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 : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "Dtype Conversions", "Regression", "Arrow" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. @mplatzer - can you give this issue a meaningful title? Currently it is `BUG:`.", "@rhshadrach sorry, my bad, I've overlooked that. A meaningful title has now been added.", "Confirmed on main. Further investigations and PRs to fix are welcome.", "I suspect the issue is related to this change (taken from the 2.2.0 release notes):\r\n> integer dtypes with missing values are cast to NumPy float dtypes and NaN is used as missing value indicator\r\nbut wouldn't know any further details", "> This bug... is not present on Pandas main branch.\r\n\r\nI'm still seeing it on main. Can you recheck, make sure we're seeing the same thing?", "Result of a git bisect:\r\n\r\n```\r\nAuthor: Patrick Hoefler\r\nDate: Thu Dec 21 23:15:49 2023 +0100\r\n\r\n Convert ArrowExtensionArray to proper NumPy dtype (#56290)\r\n```\r\n\r\ncc @phofl ", "yes, you are right, it's still happening for main\r\n```\r\n>>> import pandas as pd\r\n>>> pd.__version__\r\n'3.0.0.dev0+355.g92a52e231'\r\n>>> pd.Series([12, pd.NA], dtype=\"Int64[pyarrow]\").astype(\"string[pyarrow]\")\r\n0 12.0\r\n1 <NA>\r\n```" ]
2,133,564,954
57,417
DOC: fix SA01 errors in docstrings
closed
2024-02-14T05:24:36
2024-03-29T06:47:10
2024-03-18T02:00:49
https://github.com/pandas-dev/pandas/issues/57417
true
null
null
jordan-d-murphy
8
Pandas has a script for validating docstrings: https://github.com/pandas-dev/pandas/blob/44c50b20e8d08613144b3353d9cd0844a53bd077/ci/code_checks.sh#L416-L1426 Currently, some methods fail the SA01 check. The task here is: - take 2-4 methods - run: scripts/validate_docstrings.py --format=actions --errors=SA01 `method-name` - check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported - remove those methods from code_checks.sh - commit, push, open pull request Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels:\r\n\r\n- CI\r\n- Docs\r\n- good first issue", "Addresses https://github.com/pandas-dev/pandas/pull/57354", "opened up a fix for `pandas.ArrowDtype`", "opened a fix for \r\n```\r\npandas.BooleanDtype\r\npandas.StringDtype\r\n```", "opened a fix for the following: \r\n```\r\npandas.Categorical.as_ordered\r\npandas.Categorical.as_unordered\r\npandas.CategoricalIndex.as_ordered\r\npandas.CategoricalIndex.as_unordered\r\npandas.Series.cat.as_ordered\r\npandas.Series.cat.as_unordered\r\n```", "Hi all, if [CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826) gets merged in, I might be reworking our approach here; this would look like closing the following issues: \r\n\r\n\r\n> [DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)\r\n> [DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n> [DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n> [DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n> [DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n> [DOC: fix PR02 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57111)\r\n\r\nAnd opening a new issue to address these based on the new approach. \r\n\r\ntl;dr \r\n\r\nthe work can still be done, but probably under a new ticket once #57826 is merged in", "Closed by:\r\n[CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826)\r\n[CI: Better error control in the validation of docstrings #57879](https://github.com/pandas-dev/pandas/pull/57879) \r\n\r\nOpening a new issue to fix docstring errors. ", "Opened [DOC: Enforce Numpy Docstring Validation (Parent Issue) #58063](https://github.com/pandas-dev/pandas/issues/58063) as a parent issue for fixing docstrings based on the refactoring in code_checks.sh \r\n\r\nFeel free to swing by and help out! 🙂" ]
2,133,553,554
57,416
DOC: fix RT03 errors in docstrings
closed
2024-02-14T05:13:11
2024-09-22T12:14:23
2024-03-18T02:00:59
https://github.com/pandas-dev/pandas/issues/57416
true
null
null
jordan-d-murphy
18
Pandas has a script for validating docstrings: https://github.com/pandas-dev/pandas/blob/44c50b20e8d08613144b3353d9cd0844a53bd077/ci/code_checks.sh#L144-L414 Currently, some methods fail the RT03 check. The task here is: 1. take 2-4 methods 2. run: scripts/validate_docstrings.py --format=actions --errors=RT03 `method-name` 3. check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported 4. remove those methods from code_checks.sh 5. commit, push, open pull request Please don't comment take as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs", "good first issue" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels:\r\n\r\n- CI\r\n- Docs\r\n- good first issue", "Addresses https://github.com/pandas-dev/pandas/pull/57356", "Will work on \r\n\r\n- pandas.Index.to_numpy\r\n- pandas.Categorical.set_categories", "Continue with:\r\n\r\n- pandas.CategoricalIndex.set_categories (already valid)\r\n- pandas.DataFrame.astype\r\n- pandas.DataFrame.at_time\r\n- pandas.DataFrame.ewm", "opened a fix for `pandas.DataFrame.expanding`", "opened a fix for pandas.read_sql", "Opened a fix for `pandas.read_sql_query`, `pandas.read_feather`", "Opened a fix for below methods:\r\n`pandas.DataFrame.min`\r\n`pandas.DataFrame.max`\r\n`pandas.DataFrame.mean`\r\n`pandas.DataFrame.median`\r\n`pandas.DataFrame.skew`\r\n`pandas.DataFrame.kurt`\r\n\r\n", "Will work on:\r\npandas.DataFrame.expanding - works already\r\npandas.DataFrame.filter\r\npandas.DataFrame.first_valid_index\r\npandas.DataFrame.last_valid_index\r\npandas.DataFrame.get\r\n", "Continue with:\r\npandas.DataFrame.nsmallest\r\n pandas.DataFrame.nunique\r\n pandas.DataFrame.pipe\r\n pandas.DataFrame.plot.box \r\n pandas.DataFrame.plot.density\r\n pandas.DataFrame.plot.kde\r\n pandas.DataFrame.plot.scatter", "Will work on:\r\n\r\n- pandas.DataFrame.pop\r\n- pandas.DataFrame.reindex\r\n- pandas.DataFrame.reorder_levels\r\n- pandas.DataFrame.swapaxes - deprecated in favor of .transpose, which already has valid docstring\r\n- pandas.DataFrame.to_numpy\r\n- pandas.DataFrame.to_orc\r\n\r\n", "https://github.com/pandas-dev/pandas/blob/dc19148bf7197a928a129b1d1679b1445a7ea7c7/ci/code_checks.sh#L615-L864\r\n\r\nCurrent status: still 200+ method docstrings need to be fixed, maybe add the \"good first issue\" tag to get more people involved ;)", "agreed! I don't have permissions to add labels, otherwise I would. hopefully a core team member can add that label for us. \r\n\r\nthanks for all your work on these! ", "opened a fix for \r\n```\r\npandas.timedelta_range \r\npandas.util.hash_pandas_object\r\n```", "opened a fix for \r\n```\r\npandas.read_orc\r\npandas.read_sas\r\npandas.read_spss\r\npandas.read_stata\r\n```", "Hi all, if [CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826) gets merged in, I might be reworking our approach here; this would look like closing the following issues: \r\n\r\n\r\n> [DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)\r\n> [DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n> [DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n> [DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n> [DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n> [DOC: fix PR02 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57111)\r\n\r\nAnd opening a new issue to address these based on the new approach. \r\n\r\ntl;dr \r\n\r\nthe work can still be done, but probably under a new ticket once #57826 is merged in", "Closed by:\r\n[CI: speedup docstring check consecutive runs #57826](https://github.com/pandas-dev/pandas/pull/57826)\r\n[CI: Better error control in the validation of docstrings #57879](https://github.com/pandas-dev/pandas/pull/57879) \r\n\r\nOpening a new issue to fix docstring errors. ", "Opened [DOC: Enforce Numpy Docstring Validation (Parent Issue) #58063](https://github.com/pandas-dev/pandas/issues/58063) as a parent issue for fixing docstrings based on the refactoring in code_checks.sh \r\n\r\nFeel free to swing by and help out! 🙂" ]
2,133,522,469
57,415
DOC: Resolve SA05 errors for all ExponentialMovingWindow, Expanding, Rolling, and Window
closed
2024-02-14T04:33:49
2024-02-14T17:26:56
2024-02-14T14:49:22
https://github.com/pandas-dev/pandas/pull/57415
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57415
https://github.com/pandas-dev/pandas/pull/57415
jordan-d-murphy
1
A small change in a shared template resolved all SA05 errors for the following: ``` pandas.core.window.ewm.ExponentialMovingWindow.corr pandas.core.window.ewm.ExponentialMovingWindow.cov pandas.core.window.ewm.ExponentialMovingWindow.mean pandas.core.window.ewm.ExponentialMovingWindow.std pandas.core.window.ewm.ExponentialMovingWindow.sum pandas.core.window.ewm.ExponentialMovingWindow.var pandas.core.window.expanding.Expanding.apply pandas.core.window.expanding.Expanding.corr pandas.core.window.expanding.Expanding.count pandas.core.window.expanding.Expanding.cov pandas.core.window.expanding.Expanding.kurt pandas.core.window.expanding.Expanding.max pandas.core.window.expanding.Expanding.mean pandas.core.window.expanding.Expanding.median pandas.core.window.expanding.Expanding.min pandas.core.window.expanding.Expanding.quantile pandas.core.window.expanding.Expanding.rank pandas.core.window.expanding.Expanding.sem pandas.core.window.expanding.Expanding.skew pandas.core.window.expanding.Expanding.std pandas.core.window.expanding.Expanding.sum pandas.core.window.expanding.Expanding.var pandas.core.window.rolling.Rolling.apply pandas.core.window.rolling.Rolling.corr pandas.core.window.rolling.Rolling.count pandas.core.window.rolling.Rolling.cov pandas.core.window.rolling.Rolling.kurt pandas.core.window.rolling.Rolling.max pandas.core.window.rolling.Rolling.mean pandas.core.window.rolling.Rolling.median pandas.core.window.rolling.Rolling.min pandas.core.window.rolling.Rolling.quantile pandas.core.window.rolling.Rolling.rank pandas.core.window.rolling.Rolling.sem pandas.core.window.rolling.Rolling.skew pandas.core.window.rolling.Rolling.std pandas.core.window.rolling.Rolling.sum pandas.core.window.rolling.Rolling.var pandas.core.window.rolling.Window.mean pandas.core.window.rolling.Window.std pandas.core.window.rolling.Window.sum pandas.core.window.rolling.Window.var pandas.plotting.boxplot ``` - [x] xref #57392 - [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, very nice PR" ]
2,133,440,699
57,414
DOC: fix SA05 errors in docstring for pandas.core.groupby.DataFrameGroupBy - first, last
closed
2024-02-14T02:29:31
2024-02-14T17:08:35
2024-02-14T17:08:27
https://github.com/pandas-dev/pandas/pull/57414
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57414
https://github.com/pandas-dev/pandas/pull/57414
Pistonamey
2
- [x] xref #57392 - [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. fixing SA05 errors in docstrings for: pandas.core.groupby.DataFrameGroupBy.first pandas.core.groupby.DataFrameGroupBy.last
[ "Docs", "Clean" ]
0
0
0
0
0
0
0
0
[ "> lgtm, thanks @Pistonamey\r\n\r\nYour Welcome, so no conflicts, which means they will be merged ?", "Thanks @Pistonamey " ]
2,133,365,600
57,413
Backport PR #57388 on branch 2.2.x (BUG: map(na_action=ignore) not respected for Arrow & masked types)
closed
2024-02-14T00:49:58
2024-02-14T02:12:17
2024-02-14T02:12:17
https://github.com/pandas-dev/pandas/pull/57413
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57413
https://github.com/pandas-dev/pandas/pull/57413
meeseeksmachine
0
Backport PR #57388: BUG: map(na_action=ignore) not respected for Arrow & masked types
[ "NA - MaskedArrays", "Arrow" ]
0
0
0
0
0
0
0
0
[]
2,133,362,780
57,412
Remove method from fillna
closed
2024-02-14T00:46:12
2024-03-16T17:46:23
2024-03-16T17:46:20
https://github.com/pandas-dev/pandas/pull/57412
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57412
https://github.com/pandas-dev/pandas/pull/57412
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.
[ "Clean", "Stale" ]
0
0
0
0
0
0
0
0
[ "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." ]
2,133,355,837
57,411
BUG: read_parquet gives TypeError if dtype is a pyarrow list
open
2024-02-14T00:37:46
2024-05-14T22:15:14
null
https://github.com/pandas-dev/pandas/issues/57411
true
null
null
kinianlo
7
### 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 pyarrow as pa import pandas as pd list_int = pa.list_(pa.int64()) s = pd.Series([[1, 1], [2, 2]], dtype=pd.ArrowDtype(list_int)) df = pd.DataFrame(s, columns=['col']) df.to_parquet('ex.parquet') pd.read_parquet('ex.parquet') ``` ### Issue Description The example code produces `TypeError: data type 'list<item: int64>[pyarrow]' not understood` ### Expected Behavior No error should occur and `pd.read_parquet('ex.parquet')` should gives a data frame identical to `df` ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.10.12.final.0 python-bits : 64 OS : Linux OS-release : 6.1.58+ Version : #1 SMP PREEMPT_DYNAMIC Sat Nov 18 15:31:17 UTC 2023 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : en_US.UTF-8 LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.25.2 pytz : 2023.4 dateutil : 2.8.2 setuptools : 67.7.2 pip : 23.1.2 Cython : 3.0.8 pytest : 7.4.4 hypothesis : None sphinx : 5.0.2 blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.4 html5lib : 1.1 pymysql : None psycopg2 : 2.9.9 jinja2 : 3.1.3 IPython : 7.34.0 pandas_datareader : 0.10.0 adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : 2023.6.0 gcsfs : 2023.6.0 matplotlib : 3.7.1 numba : 0.58.1 numexpr : 2.9.0 odfpy : None openpyxl : 3.1.2 pandas_gbq : 0.19.2 pyarrow : 10.0.1 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.4 sqlalchemy : 2.0.25 tables : 3.8.0 tabulate : 0.9.0 xarray : 2023.7.0 xlrd : 2.0.1 zstandard : None tzdata : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "IO Parquet", "Arrow" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Can you give this issue a meaningful title? Currently it is `BUG:`.", "> Thanks for the report. Can you give this issue a meaningful title? Currently it is `BUG:`.\r\n\r\nThanks! Title updated.", "Thanks for the report - further investigations and PRs to fix are welcome!", "take", "I have done some digging into the problem. By inspecting the stack trace:\r\n```python-traceback\r\nTraceback (most recent call last):\r\n File \"/Users/kinianlo/github/pandas/scripts/debug.py\", line 19, in <module>\r\n pd.read_parquet('ex.parquet', engine='auto')\r\n File \"/Users/kinianlo/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pandas/io/parquet.py\", line 670, in read_parquet\r\n return impl.read(\r\n File \"/Users/kinianlo/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pandas/io/parquet.py\", line 279, in read\r\n result = pa_table.to_pandas(**to_pandas_kwargs)\r\n File \"pyarrow/array.pxi\", line 867, in pyarrow.lib._PandasConvertible.to_pandas\r\n File \"pyarrow/table.pxi\", line 4085, in pyarrow.lib.Table._to_pandas\r\n File \"/Users/kinianlo/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pyarrow/pandas_compat.py\", line 764, in table_to_blockmanager\r\n ext_columns_dtypes = _get_extension_dtypes(\r\n File \"/Users/kinianlo/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pyarrow/pandas_compat.py\", line 817, in _get_extension_dtypes\r\n pandas_dtype = _pandas_api.pandas_dtype(dtype)\r\n File \"pyarrow/pandas-shim.pxi\", line 140, in pyarrow.lib._PandasAPIShim.pandas_dtype\r\n File \"pyarrow/pandas-shim.pxi\", line 143, in pyarrow.lib._PandasAPIShim.pandas_dtype\r\n File \"/Users/kinianlo/.pyenv/versions/3.10.13/lib/python3.10/site-packages/pandas/core/dtypes/common.py\", line 1636, in pandas_dtype\r\n npdtype = np.dtype(dtype)\r\nTypeError: data type 'list<item: int64>[pyarrow]' not understood\r\n``` \r\nit appears that the problem comes from the `table_to_blockmanager` function in `pyarrow.pandas_compat.py`. If `pandas_metadata` exists in the pyarrow table (which comes ultimately from the metadata in the parquet file written by pandas) AND the argument `ignore_metadata=False` then `table_to_blockmanager` would try to construct pandas extension data types using the information from the metadata. For some reason the `_get_extension_dtypes` function which is called by `table_to_blockmanager` would try to reconstruct a numpy datatype even if a `type_mapper` is supplied, using the `numpy_type` in the metadata. This would not cause a problem if `numpy_type` is set to `object` but if instead it is set to e.g. `list<item: int64>[pyarrow]` then numpy would struggle to understand this datatype.\r\n\r\n### Example of metadata:\r\nThe metadata that I was referring to can be obtained through a pyarrow table, e.g. `pq.read_table('ex.parquet').schema.metadata`\r\n- A __bad__ metadata that would causes the error reported:\r\n\r\n{b'pandas': b'{\"index_columns\": [{\"kind\": \"range\", \"name\": null, \"start\": 0, \"stop\": 2, \"step\": 1}], \"column_indexes\": [{\"name\": null, \"field_name\": null, \"pandas_type\": \"unicode\", \"numpy_type\": \"object\", \"metadata\": {\"encoding\": \"UTF-8\"}}], \"columns\": [{\"name\": \"col\", \"field_name\": \"col\", \"pandas_type\": \"list[int64]\", __\"numpy_type\": \"list<item: int64>[pyarrow]\"__, \"metadata\": null}], \"creator\": {\"library\": \"pyarrow\", \"version\": \"11.0.0\"}, \"pandas_version\": \"2.1.4\"}'}\r\n\r\n- A __good__ metadata:\r\n\r\n{b'pandas': b'{\"index_columns\": [{\"kind\": \"range\", \"name\": null, \"start\": 0, \"stop\": 2, \"step\": 1}], \"column_indexes\": [{\"name\": null, \"field_name\": null, \"pandas_type\": \"unicode\", \"numpy_type\": \"object\", \"metadata\": {\"encoding\": \"UTF-8\"}}], \"columns\": [{\"name\": \"col\", \"field_name\": \"col\", \"pandas_type\": \"list[int64]\", __\"numpy_type\": \"object\"__, \"metadata\": null}], \"creator\": {\"library\": \"pyarrow\", \"version\": \"11.0.0\"}, \"pandas_version\": \"2.1.4\"}'}\r\n\r\n\r\n### temporary fix\r\nUse `pyarrow.parquet.read_table` to read the parquet from disk, and then use `.to_pandas(ignore_metadata=True)` to convert the pyarrow table to a panda dataframe while ignoring the metadata.\r\n\r\n### potential long term fix\r\nEnsure that `numpy_type` is set to `object` when appropriate, e.g. when it is a list of somethings. ", "Hello everyone!\r\nI managed to make a fix to this problem. But I am not sure if this is a good solution.\r\nI had another if statement (last one) to the function \"pandas_dtype\" in the \"common.py\" file\r\n\r\n```\r\nif isinstance(dtype, np.ndarray):\r\n return dtype.dtype \r\nelif isinstance(dtype, (np.dtype, ExtensionDtype)):\r\n return dtype\r\nelif (\"list\" in str(dtype) and \"pyarrow\" in str(dtype)):\r\n return dtype\r\n```\r\n\r\nWhat do you think about this solution?", "After some further digging, I propose the following two potential solutions:\r\n\r\n1) Ensure that the relevant `numpy_type` in the metadata is set to `object` when the dataframe is saved as a parquet. This has been proven to work. Although I am not entirely sure how to do it and would it affect other behaviours.\r\n2) When the parquet is read, dtypes of columns are inferred first using `pandas.core.dtypes.base._registry` (which is done in the [pandas_dtype](https://github.com/pandas-dev/pandas/blob/986074b4901511a4e87a99854fc62f8c24bdbb71/pandas/core/dtypes/common.py#L1600) function). If this fails to find a dtype, `np.dtype(dtype)` is called which causes the error because numpy doesn't understand the arrow type. The solution is to make sure that the dtype can be found in registry. The registry uses the [ArrowDtype.construct_from_string](https://github.com/pandas-dev/pandas/blob/986074b4901511a4e87a99854fc62f8c24bdbb71/pandas/core/dtypes/dtypes.py#L2288) method. Note that atomic types such as `int64[pyarrow]` can already be reconsigned by `construct_from_string` as it should, but fails to recognises `list<item: int64>[pyarrow]`. All we need to do is to ensure the a string representation such as `list<item: int64>[pyarrow]` can be recognised. This fix should not interferer with behaviours." ]
2,133,326,036
57,410
Remove downcast from Index.fillna
closed
2024-02-14T00:03:23
2024-02-14T09:03:30
2024-02-14T02:12:46
https://github.com/pandas-dev/pandas/pull/57410
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57410
https://github.com/pandas-dev/pandas/pull/57410
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. I think this is covered by the other whatsnews
[ "Clean" ]
0
0
0
0
0
0
0
0
[ "Thanks @phofl " ]
2,133,223,823
57,409
ENH: df.columns returns list of series
closed
2024-02-13T22:24:27
2024-03-18T01:56:07
2024-03-18T01:56:06
https://github.com/pandas-dev/pandas/issues/57409
true
null
null
R3dan
6
### Feature Type - [X] Adding new functionality to pandas - [X] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description Currently you can go df[{column label}] to access a column or df.columns to access the column labels. I propose either a new list that is like df.columns but with the series returned by df[{column}] or just replace df.columns with this new column. As long as you can access the label I don't see why not. This could also allow for adding or removinf new columns by editing df.columns ### Feature Description Completely new code could be needed or accessing the same as __getitem__ does: ```[i for i in indexes]``` with indexes being the columns. ### Alternative Solutions ` for i in df: column=df[i] ` ### Additional Context _No response_
[ "Enhancement", "Indexing", "Needs Info", "Closing Candidate" ]
0
0
0
0
0
0
0
0
[ "Thanks for the request. I would recommend using `[e for _, e in df.items()]`. \r\n\r\nWhat advantage does adding a method here provide a user that is difficult / not possible today?", "> This could also allow for adding or removinf new columns by editing df.columns\r\n\r\nAdding a new method for getting a list of Series wouldn't be that difficult (though im -1 since there are easy alternatives), but making it editable like this _would_ be difficult.", "I think the biggest problem is how `DataFrame.values` ended up being implemented. I'm slightly curious to know why it wasn't done to return an iterable of `Series` that follow the `.keys` and `.items` analog from `dict`", "I would hazard a guess that `.values` as added prior to any active core member. In any case, I think it would be far too disruptive to change now.", "Absolutely, I wasn't suggesting that. More being sympathetic to OP here.", "closing, -1 on doing this as well" ]
2,133,216,939
57,408
DOC: fix SA05 errors in docstrings for pandas.PeriodIndex.asfreq, arr…
closed
2024-02-13T22:18:15
2024-02-14T04:13:20
2024-02-14T02:13:30
https://github.com/pandas-dev/pandas/pull/57408
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57408
https://github.com/pandas-dev/pandas/pull/57408
williamking1221
1
…ays - ArrowStringArray, StringArray - [x] xref #57392 - [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
[ "Thanks @williamking1221 " ]
2,133,173,034
57,407
BUG: to_csv and load_csv add columns
closed
2024-02-13T21:39:27
2024-02-13T22:41:10
2024-02-13T22:41:03
https://github.com/pandas-dev/pandas/issues/57407
true
null
null
R3dan
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 import pandas as pd df = pd.DataFrame() #any data frame from list of lists df.to_csv("file.csv") df2=pd.load_csv("file.csv") print(df2.columns) print(df.columns) print(df.columns == df2.columns) ``` ### Issue Description When you do as the example with any data frame created with a list of lists (only one I've tested) it returns what was the row ids as an extra column. ### Expected Behavior I would expect that the DataFrame is returned identical. WIthout the row index as the row index and an extra column ### Installed Versions pandas : 2.1.4 numpy : 1.26.2 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 69.0.2 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 : 3.1.2 IPython : 8.16.1 pandas_datareader : None bs4 : 4.12.2 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 pyxlsb : None s3fs : None scipy : 1.11.4 sqlalchemy : 2.0.23 tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.3 qtpy : None pyqt5 : None
[ "Bug", "IO CSV" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. When submitting bug reports, please provide a full reproducible example if possible.\r\n\r\nIn this example, `DataFrame.to_csv` includes the index by default. You need to pass `index=False` if you do not want this to happen.\r\n\r\nClosing for now. If you think there is still an issue with pandas, comment here and we can reopen." ]
2,133,102,823
57,406
CLN: Misc pre-COW stuff
closed
2024-02-13T20:48:48
2024-02-13T23:00:44
2024-02-13T23:00:41
https://github.com/pandas-dev/pandas/pull/57406
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57406
https://github.com/pandas-dev/pandas/pull/57406
mroeschke
0
null
[ "Clean", "Copy / view semantics" ]
0
0
0
0
0
0
0
0
[]
2,133,033,260
57,405
CLN: Enforce nonkeyword deprecations
closed
2024-02-13T19:55:52
2024-02-14T02:11:06
2024-02-14T00:46:53
https://github.com/pandas-dev/pandas/pull/57405
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57405
https://github.com/pandas-dev/pandas/pull/57405
mroeschke
1
xref https://github.com/pandas-dev/pandas/pull/56493
[ "Clean" ]
0
0
0
0
0
0
0
0
[ "thx @mroeschke " ]
2,132,935,871
57,404
DOC: fix SA05 errors in docstring for pandas.DataFrame - agg, aggregate, boxplot
closed
2024-02-13T18:41:13
2024-02-13T20:04:58
2024-02-13T19:56:34
https://github.com/pandas-dev/pandas/pull/57404
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57404
https://github.com/pandas-dev/pandas/pull/57404
jordan-d-murphy
1
All SA05 Errors resolved in the following cases: 1. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.DataFrame.agg 2. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.DataFrame.aggregate 3. scripts/validate_docstrings.py --format=actions --errors=SA05 pandas.DataFrame.boxplot - [x] xref https://github.com/pandas-dev/pandas/issues/57392 - [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
[ "Thanks @jordan-d-murphy " ]
2,132,851,037
57,403
Deprecate ``future.no_silent_downcasting``
open
2024-02-13T17:45:22
2024-03-24T18:16:47
null
https://github.com/pandas-dev/pandas/issues/57403
true
null
null
phofl
3
Deprecation is enforced, so should deprecate the option #57328
[ "Deprecate" ]
0
0
0
0
0
0
0
0
[ "I think this should be closed now that #57328 has been merged", "no, we have to deprecate the option", "I thought that PR did that, my bad" ]
2,132,485,431
57,402
BUG: wrong future Warning on string assignment in certain condition
closed
2024-02-13T14:41:08
2024-02-16T17:57:55
2024-02-16T17:57:46
https://github.com/pandas-dev/pandas/pull/57402
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57402
https://github.com/pandas-dev/pandas/pull/57402
MarcoGorelli
1
- [ ] closes #56503 (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. is this it? finally? 🤞
[ "Warnings", "PDEP6-related" ]
0
0
0
0
0
0
0
0
[ "Thanks @MarcoGorelli " ]
2,132,369,777
57,401
CI: Format rst code blocks with blacken-docs
closed
2024-02-13T13:49:29
2024-03-12T06:35:24
2024-03-12T06:35:20
https://github.com/pandas-dev/pandas/pull/57401
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57401
https://github.com/pandas-dev/pandas/pull/57401
tqa236
5
- [ ] closes #46865 - [ ] [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", "CI", "Code Style" ]
0
0
0
0
0
0
0
0
[ "What's the plan with this @tqa236? Are the problems in the CI a blocker to move forward with this?", "hi @datapythonista, this problem is not related to the recent broken CI, although the broken CI indeed doesn't help testing or exploring.\r\n\r\nThe exact issue that prevents us from having a green CI is just the number of new lines in some code blocks in the doc where `black` enforces the new lines but `ipython` raises a warning there, which are treated as errors per our configuration. This warning doesn't affect the build, as the rendered doc still looks correct.\r\n\r\nThe approach I'm exploring now is a way to disable this warning by passing `ipython_warning_is_error=False` to silent this warning while still keeping other `sphinx` warning. \r\n\r\nI raised the issue [here](https://github.com/ipython/ipython/issues/14333) and [here](https://github.com/ipython/ipython/issues/14334) as well, but any quick change seems unlikely.\r\n\r\nIf you can point me to where I can pass `jupyter` or `sphinx` config to the build, it would be a great help.", "Thanks for the update @tqa236.\r\n\r\nI can't find the warnings in the doc build, are they still happening?\r\n\r\nConfiguration changes should be placed in `doc/source/conf.py`, I see an `nbsphinx` option to control the warnings: https://nbsphinx.readthedocs.io/en/0.9.3/configuration.html#suppress_warnings\r\n\r\nI don't fully understand why ipython/nbsphinx should complain about blank lines, they shouldn't validate the style or format that I know, just execute the code. I can have a look if you can point me to the warnings that are making the CI fail, I only see an error I think I saw in other PRs about the section underlines.\r\n\r\nCC @MarcoGorelli in case you have any opinion here.", "thanks for pointing me to the conf file, @datapythonista. I'm able to pass the IPython config to the sphinx build now. \r\n\r\nUnfortunately, my approach doesn't work yet, as a warning is still raised, and sphinx will fail the build because of that. \r\n\r\nI'll need to think of another solution.", "closed as I don't know how to proceed yet." ]
2,131,986,862
57,400
BUG: Excel URLs disappear after 65530
closed
2024-02-13T10:29:35
2024-02-13T23:38:32
2024-02-13T17:14:40
https://github.com/pandas-dev/pandas/issues/57400
true
null
null
pickfire
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. - [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 # pip install pandas xlsxwriter import pandas as pd df = pd.DataFrame({'url': ['https://google.com'] * 100000}) df.to_excel('hello.xlsx', index=False) ``` ### Issue Description Excel have a limit of 65530 URLs in a single sheet, once it is passed the URLs are gone. Upstream issue closed as won't fixed https://github.com/jmcnamara/XlsxWriter/issues/1043 ### Expected Behavior Number of URLs should be tracked and once it go past 65530 URLs, it should should still be visible but unclickable. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.7.final.0 python-bits : 64 OS : Linux OS-release : 6.7.2-zen1-2-zen Version : #1 ZEN SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:18 +0000 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 2.2.0 numpy : 1.26.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 65.5.0 pip : 23.2.1 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 : 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 : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report, but pandas just dispatches to the underlying library to parse excel. So closing as an upstream issue. Maybe you can try submitting a request to openpyxl?", "Looks like it works on openpyxl but none of the URLs are clickable." ]
2,131,867,509
57,399
Fix for issue #57268 - ENH: Preserve input start/end type in interval…
closed
2024-02-13T09:28:49
2024-02-15T17:57:56
2024-02-15T17:35:06
https://github.com/pandas-dev/pandas/pull/57399
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57399
https://github.com/pandas-dev/pandas/pull/57399
VISWESWARAN1998
5
…_range - [ ] closes #57268 - [ ] [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.
[ "Dtype Conversions", "Interval" ]
0
0
0
0
0
0
0
0
[ "> ew note in `v3.0.0.rst` and a unit test.\r\n> \r\n> Also could you fix this for float types too?\r\n\r\nCan you give me an example for float type with expected results? Thank you!", "I have added my implementations for supporting float types. But I see in base.py that pandas doesn't support float16 data types. Should I convert them to float64 or just let pandas thow Exception?\r\n\r\nbase.py:\r\n```python3\r\nelif dtype == np.float16:\r\n # float16 not supported (no indexing engine)\r\n raise NotImplementedError(\"float16 indexes are not supported\")\r\n```\r\n\r\nFor example:\r\n\r\n```python3\r\ninterval_index_float = pd.interval_range(start=np.float32(0.0), end=np.float32(0.6), freq=0.5, closed=\"left\")\r\nprint(interval_index_float)\r\n```\r\n\r\nGives:\r\n\r\n```\r\nIntervalIndex([[0.0, 0.5)], dtype='interval[float32, left]')\r\n```\r\n\r\nBut:\r\n\r\n```python3\r\ninterval_index_float = pd.interval_range(start=np.float16(0.0), end=np.float16(0.6), freq=0.5, closed=\"left\")\r\nprint(interval_index_float)\r\n```\r\n\r\nwill raise:\r\n\r\n`NotImplementedError: float16 indexes are not supported`\r\n\r\nI have added implementation to ignore float16 like this and checked-in my changes. If you want to let it throw an exception let me know!\r\n\r\nMy implementation:\r\n\r\n```python3\r\nif isinstance(start, float | np.float16) or isinstance(\r\n end, float | np.float16\r\n ):\r\n dtype = np.dtype(\"float64\")\r\nelse:\r\n dtype = start.dtype if start.dtype == end.dtype else np.dtype(\"float64\")\r\nbreaks = np.arange(start, end + (freq * 0.1), freq, dtype=dtype)\r\n```\r\n\r\nCurrent implementation safely returns float64 if it finds float16, Just like current main release!\r\n\r\n", "Changes have been completed as you asked!", "Thanks @VISWESWARAN1998 ", "You are most welcome @mroeschke !" ]
2,131,740,558
57,398
BUG: groupby category type variable fails when suppressing the FutureWarning
closed
2024-02-13T08:26:05
2024-02-13T22:49:44
2024-02-13T22:49:07
https://github.com/pandas-dev/pandas/issues/57398
true
null
null
J-ZW-Wang
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 import warnings warnings.simplefilter('ignore', category = 'FutureWarning') aa = pd.DataFrame({ 'group' : [1, 1, 2, 2, 3, 3], 'values' : range(6) }) aa['group'] = aa['group'].astype('category') aa.info() aa.groupby('group')['values'].mean() ``` ### Issue Description When I suppress the FutureWarning, the groupby() operation would fail on 'category' type variable, resulting in the following message: ``` TypeError: issubclass() arg 2 must be a class, a tuple of classes, or a union ``` When I remove the suppressing message (requires restart of the kernel), The FutureWarning would appear however the groupby() operation will go through without any issue: ``` FutureWarning: The default of observed=False is deprecated and will be changed to True in a future version of pandas. Pass observed=False to retain current behavior or observed=True to adopt the future default and silence this warning. ``` ### Expected Behavior The groupby() operation should go through without error messages when suppressing the warnings. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.11.5.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22621 machine : AMD64 processor : AMD64 Family 23 Model 96 Stepping 1, AuthenticAMD byteorder : little LC_ALL : None LANG : None LOCALE : English_United States.1252 pandas : 2.2.0 numpy : 1.24.3 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 68.0.0 pip : 23.2.1 Cython : None pytest : 7.4.0 hypothesis : None sphinx : 5.0.2 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 : 1.3.7 dataframe-api-compat : None fastparquet : None fsspec : 2023.4.0 gcsfs : None matplotlib : 3.7.2 numba : 0.57.1 numexpr : 2.8.4 odfpy : None openpyxl : None pandas_gbq : None pyarrow : 11.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : 2023.4.0 scipy : 1.11.1 sqlalchemy : None tables : 3.8.0 tabulate : None xarray : 2023.6.0 xlrd : None zstandard : 0.19.0 tzdata : 2023.3 qtpy : None pyqt5 : None </details>
[ "Bug", "Groupby", "Warnings" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. [filterwarnings](https://docs.python.org/3/library/warnings.html#warnings.filterwarnings) takes a class as a 3rd argument, not a string. You want:\r\n\r\n warnings.simplefilter('ignore', category=FutureWarning)\r\n\r\nClosing for now. If you think there is still an issue with pandas, comment here and we can reopen.\r\n" ]
2,131,620,302
57,397
TST: Add missing skips for unavailable pyarrow
closed
2024-02-13T07:25:19
2025-02-10T18:51:43
2025-02-10T18:51:43
https://github.com/pandas-dev/pandas/pull/57397
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57397
https://github.com/pandas-dev/pandas/pull/57397
QuLogic
7
The `all_parsers` fixture has this check, but some of the other fixtures were missing it. - [n/a] closes #xxxx (Replace xxxx with the GitHub issue number) - [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature - [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). - [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions. - [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", "Stale", "Arrow" ]
0
0
0
0
0
0
0
0
[ "Given #54466, this is primarily targeted at getting backported to 2.2.x.", "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.", "This isn't waiting for me, AFAICT.", "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.", "Again, it was [waiting for you to reply](https://github.com/pandas-dev/pandas/pull/57397#discussion_r1488731996).", "OK sorry I missed that. Could you resolve the merge conflict?", "It appears another PR fixed the problem this PR was trying to solve. Sorry we weren't able to get this in in the meantime, but closing this PR out." ]
2,131,467,989
57,396
BUG: Ensure consistent kwarg only restriction on df.any and df.all
closed
2024-02-13T05:01:27
2024-03-20T17:02:40
2024-03-20T17:02:40
https://github.com/pandas-dev/pandas/pull/57396
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57396
https://github.com/pandas-dev/pandas/pull/57396
aidoskanapyanov
5
- [x] closes #57087 - [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.
[ "Stale", "Reduction Operations" ]
0
0
0
0
0
0
0
0
[ "Oh, my bad, okay 👌\nGotta learn about deprecating", "> Gotta learn about deprecating\r\n\r\nLuckily, it is quite simple:\r\n\r\n1) you decorate the method with this:\r\n`@deprecate_nonkeyword_arguments(version=\"3.0\", allowed_args=[\"self\"], name=\"all\")`\r\nwhere `name` is the name of the method.\r\n\r\n2) Add a whatsnew entry\r\n\r\n3) Ideally, have a test (not sure whether that is needed)\r\n\r\nThese deprecations apply to both DataFrame and Series for at least the following methods: any, all, min, max, mean, median, sum, prod, std, var, sem, skew, kurt.\r\n\r\n\r\nI had [similar changes in this PR](https://github.com/pandas-dev/pandas/pull/56739/commits/9de4f705f4ea170ae5aca64fddc704ef51db4905#diff-421998af5fe0fbc54b35773ce9b6289cae3e8ae607f81783af04ebf1fbcaf077) but removed them from the PR to keep it easier to merge. Feel free to have a look at that PR to see how to adjust some of the tests (some of them will fail when you deprecate positional arguments).\r\n", "> Luckily, it is quite simple:\r\n\r\nThank you for explaining, this is super helpful! 👍", "This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.", "Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen." ]
2,131,453,170
57,395
BUG: `KeyError: DictionaryType` when converting to/from PyArrow backend
open
2024-02-13T04:43:32
2024-02-19T22:28:21
null
https://github.com/pandas-dev/pandas/issues/57395
true
null
null
ajfriend
7
### 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 import pyarrow as pa import pyarrow.parquet as pq import seaborn as sns df = sns.load_dataset('diamonds') table = pa.Table.from_pandas(df) df2 = table.to_pandas(types_mapper=pd.ArrowDtype) df2.convert_dtypes(dtype_backend='numpy_nullable') ``` ### Issue Description I get an error `KeyError: DictionaryType(dictionary<values=string, indices=int8, ordered=0>)` with a traceback like the following: <details> <summary>Click me</summary> ``` --------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[27], line 9 7 table = pa.Table.from_pandas(df) 8 df2 = table.to_pandas(types_mapper=pd.ArrowDtype) ----> 9 df2.convert_dtypes(dtype_backend='numpy_nullable') File [~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/generic.py:7025](http://localhost:8888/lab/tree/~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/generic.py#line=7024), in NDFrame.convert_dtypes(self, infer_objects, convert_string, convert_integer, convert_boolean, convert_floating, dtype_backend) 6896 """ 6897 Convert columns to the best possible dtypes using dtypes supporting ``pd.NA``. 6898 (...) 7022 dtype: string 7023 """ 7024 check_dtype_backend(dtype_backend) -> 7025 new_mgr = self._mgr.convert_dtypes( # type: ignore[union-attr] 7026 infer_objects=infer_objects, 7027 convert_string=convert_string, 7028 convert_integer=convert_integer, 7029 convert_boolean=convert_boolean, 7030 convert_floating=convert_floating, 7031 dtype_backend=dtype_backend, 7032 ) 7033 res = self._constructor_from_mgr(new_mgr, axes=new_mgr.axes) 7034 return res.__finalize__(self, method="convert_dtypes") File [~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/managers.py:456](http://localhost:8888/lab/tree/~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/managers.py#line=455), in BaseBlockManager.convert_dtypes(self, **kwargs) 453 else: 454 copy = True --> 456 return self.apply( 457 "convert_dtypes", copy=copy, using_cow=using_copy_on_write(), **kwargs 458 ) File [~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/managers.py:364](http://localhost:8888/lab/tree/~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/managers.py#line=363), in BaseBlockManager.apply(self, f, align_keys, **kwargs) 362 applied = b.apply(f, **kwargs) 363 else: --> 364 applied = getattr(b, f)(**kwargs) 365 result_blocks = extend_blocks(applied, result_blocks) 367 out = type(self).from_blocks(result_blocks, self.axes) File [~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/blocks.py:694](http://localhost:8888/lab/tree/~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/blocks.py#line=693), in Block.convert_dtypes(self, copy, using_cow, infer_objects, convert_string, convert_integer, convert_boolean, convert_floating, dtype_backend) 691 for blk in blks: 692 # Determine dtype column by column 693 sub_blks = [blk] if blk.ndim == 1 or self.shape[0] == 1 else blk._split() --> 694 dtypes = [ 695 convert_dtypes( 696 b.values, 697 convert_string, 698 convert_integer, 699 convert_boolean, 700 convert_floating, 701 infer_objects, 702 dtype_backend, 703 ) 704 for b in sub_blks 705 ] 706 if all(dtype == self.dtype for dtype in dtypes): 707 # Avoid block splitting if no dtype changes 708 rbs.append(blk.copy(deep=copy)) File [~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/blocks.py:695](http://localhost:8888/lab/tree/~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/internals/blocks.py#line=694), in <listcomp>(.0) 691 for blk in blks: 692 # Determine dtype column by column 693 sub_blks = [blk] if blk.ndim == 1 or self.shape[0] == 1 else blk._split() 694 dtypes = [ --> 695 convert_dtypes( 696 b.values, 697 convert_string, 698 convert_integer, 699 convert_boolean, 700 convert_floating, 701 infer_objects, 702 dtype_backend, 703 ) 704 for b in sub_blks 705 ] 706 if all(dtype == self.dtype for dtype in dtypes): 707 # Avoid block splitting if no dtype changes 708 rbs.append(blk.copy(deep=copy)) File [~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/dtypes/cast.py:1150](http://localhost:8888/lab/tree/~/work/keepdb/env/lib/python3.11/site-packages/pandas/core/dtypes/cast.py#line=1149), in convert_dtypes(input_array, convert_string, convert_integer, convert_boolean, convert_floating, infer_objects, dtype_backend) 1147 inferred_dtype = ArrowDtype(pa_type) 1148 elif dtype_backend == "numpy_nullable" and isinstance(inferred_dtype, ArrowDtype): 1149 # GH 53648 -> 1150 inferred_dtype = _arrow_dtype_mapping()[inferred_dtype.pyarrow_dtype] 1152 # error: Incompatible return value type (got "Union[str, Union[dtype[Any], 1153 # ExtensionDtype]]", expected "Union[dtype[Any], ExtensionDtype]") 1154 return inferred_dtype KeyError: DictionaryType(dictionary<values=string, indices=int8, ordered=0>) ``` </details> ### Expected Behavior I would expect `df2.convert_dtypes()` to run without error and return a DataFrame. ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : fd3f57170aa1af588ba877e8e28c158a20a4886d python : 3.11.2.final.0 python-bits : 64 OS : Darwin OS-release : 23.2.0 Version : Darwin Kernel Version 23.2.0: Wed Nov 15 21:55:06 PST 2023; root:xnu-10002.61.3~2/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.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.1.0 pip : 24.0 Cython : None pytest : 8.0.0 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : None pymysql : None psycopg2 : None jinja2 : 3.1.3 IPython : 8.21.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 : 3.8.2 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 : 2024.1 qtpy : None pyqt5 : None </details>
[ "Bug", "Dtype Conversions", "Needs Discussion", "Arrow", "pyarrow dtype retention" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. I'm not certain this shouldn't raise. Besides raising, it seems to me the only reasonable results are to either not convert or convert to NumPy object dtype. But neither of these are NumPy-nullable dtypes. That suggests to me the operation cannot be performed, i.e. should raise.\r\n\r\ncc @jorisvandenbossche ", "I see. So this might just be user error on my part due to lack of understanding.\r\n\r\nFor context, my broader goal is to define a \"canonical\" backend and some conversion functions to/from PyArrow/Parquet such that I can do a round trip from DataFrame --> Pyarrow/Parquet --> DataFrame and get the same types back that I started with, and then test the dataframes for equality.\r\n\r\nIt wasn't immediately clear to me which collection of `types_mapper=pd.ArrowDtype`, `dtype_backend='numpy_nullable'`, and `dtype_backend='numpy_nullable'` I should be using. ", "Generally when using Arrow types, it's important to realize there are Arrow types (like dictionary) that don't map to Numpy types. See the table in https://pandas.pydata.org/docs/reference/arrays.html#pyarrow\r\n\r\nIf your goal to validate a round-trip, it's best to round trip within Arrow types or within Numpy types. As seen in the table in the link above, the only strong parallel between the types are numeric types.", "> That suggests to me the operation cannot be performed, i.e. should raise.\r\n\r\nOr, ignore the column? (and leave it as is) \r\n\r\nI agree there is no operation that can be done (in the \"nullable dtypes\" realm, we don't yet have a categorical / dictionary type), but there are other cases where this also occurs, eg for our default categorical, or datetime64 or interval dtypes. Those dtypes are also not considered as \"numpy_nullable\", but such columns are left intact. \r\n", "> such that I can do a round trip from DataFrame --> Pyarrow/Parquet --> DataFrame and get the same types back that I started with, and then test the dataframes for equality.\r\n\r\n@ajfriend In general, not specifying any specific keyword (like `types_mapper` or `dtype_backend`) should work. When converting pandas to pyarrow, some metadata about the original dtypes is stored, which is used to try to restore the original dataframe as best as possible when converting back to pandas.", "Thanks. This background helps. \r\n\r\nFor my current project, I am able pick what format I want the \"original\" dataframe to be in (the baseline that I would use for comparison), so I'm trying to research what the most stable types/backend would be, knowing that I'll be storing them as parquet files (but open to alternatives) and with an eye towards what the future of Pandas/Arrow will look like.\r\n\r\nAt a high level, I think I'm just trying to wrap my head around when I should be using Arrow types vs \"classic pandas\" types, and how they all fit together. Is it fair to say that these details are still being worked out as of Pandas 2.0, and there should be more obvious mappings between pandas types and arrow/parquet types in Pandas 3.0? Perhaps the answer is that I should just be looking forward to 3.0.\r\n\r\nRight now, I don't have a great mental model to help me expect what the output of a conversion will be, or what the correct default type should be, if such a thing even exists.\r\n\r\nFor example, if I have data like\r\n\r\n```python\r\ndf = pd.DataFrame({\r\n 'colA': [1, 2, 3, None],\r\n 'colB': ['A', 'B', 'C', None],\r\n})\r\n```\r\n\r\nand I use various combinations of transforms like `.astype('category')`, `pa.Table.from_pandas(df).to_pandas()`, `convert_dtypes()`, with combinations of options `dtype_backend` and `types_mapper`, I'll can end up with types like\r\n\r\n`object`\r\n`string`\r\n`string[pyarrow]`\r\n`category`\r\n`dictionary<values=string, indices=int8, ordered=0>[pyarrow]`\r\n\r\nand\r\n\r\n`float64`\r\n`Float64`\r\n`Int64`\r\n`int64[pyarrow]`\r\n`double[pyarrow]`\r\n\r\nThat's a lot of options. I understand the differences between these types and their use cases, but I'm still not sure if I should be using, for example, `category`, `dictionary<values=string, indices=int8, ordered=0>[pyarrow]`, `string`, or `string[pyarrow]`. Or when I should expect a float vs a nullable int. Or when to expect an error like what I posed above (I also like the idea to ignore the column to avoid the error.)\r\n\r\nMaybe the answer for now is that I just need to pick one and be careful about the conversions, but I'm hoping for a future where a lot of that is taken care of for me with reasonable defaults.\r\n\r\nBut I'm sure that its a very tough problem for you all to figure out defaults that work well for most use cases, so I appreciate all the work you're putting in!\r\n\r\n\r\n", "To phrase my problem another way, is there a standard way to \"canonicalize\" a Pandas dataframe to use PyArrow types? I'm looking for something idempotent and would be robust to roundtrips.\r\n\r\nHere are two attempts:\r\n\r\n```python\r\ndef canon1(df): # works, but doesn't use pyarrow categorical\r\n df = df.convert_dtypes(dtype_backend='pyarrow')\r\n table = pa.Table.from_pandas(df)\r\n df = table.to_pandas()\r\n df = df.convert_dtypes(dtype_backend='pyarrow')\r\n return df\r\n\r\ndef canon2(df): # not idempotent; gives error\r\n df = df.convert_dtypes(dtype_backend='pyarrow')\r\n table = pa.Table.from_pandas(df)\r\n df = table.to_pandas(types_mapper=pd.ArrowDtype)\r\n return df\r\n```\r\n\r\nWith data like\r\n\r\n```python\r\ndf = pd.DataFrame({\r\n 'colA': [1, 2, 3, None],\r\n 'colB': ['A', 'B', 'C', None],\r\n 'colC': ['aa', 'bb', 'cc', None],\r\n})\r\ndf['colC'] = df['colC'].astype('category')\r\n```\r\n\r\nI end up with types\r\n\r\n```python\r\n>>> canon1(df).dtypes\r\ncolA int64[pyarrow]\r\ncolB string[pyarrow]\r\ncolC category\r\n\r\n>>> canon2(df).dtypes\r\ncolA int64[pyarrow]\r\ncolB string[pyarrow]\r\ncolC dictionary<values=string, indices=int8, ordere...\r\n```\r\n\r\nA few notes/questions:\r\n\r\n- If I comment out the last transform of `canon1()` (`df = df.convert_dtypes(dtype_backend='pyarrow')`) I get slightly different outputs. Either `pandas.core.dtypes.dtypes.ArrowDtype` or `pandas.core.arrays.string_.StringDtype`, and it isn't immediately clear if there's a significant difference here. The string representation of the `StringDtype` type is different under `df.info()` and `df.dtypes`: `string` vs. `string[pyarrow]`\r\n- `canon1()` seems to work ok and seems to be idempotent, but doesn't use pyarrow for the categorical type :(\r\n- `canon2()` isn't idempotent; I get a `ValueError: format number 1 of \"dictionary<values=string, indices=int8, ordered=0>[pyarrow]\" is not recognized`\r\n- I also can't do a roundtrip to arrow like `pa.Table.from_pandas(canon2(df)).to_pandas()`. I get the same `ValueError: format number 1 of \"dictionary<values=string, indices=int8, ordered=0>[pyarrow]\" is not recognized`\r\n\r\nIs there a better way to do this? Does this idea of \"PyArrow canonicalization\" even make sense?\r\n\r\n(Also, I may have strayed from the original question, but I'm happy to split these out into separate issues if that seems worthwhile.)\r\n" ]
2,131,447,898
57,394
TST: Fix test_str_encode on big endian machines
closed
2024-02-13T04:36:58
2024-02-13T23:20:58
2024-02-13T17:09:52
https://github.com/pandas-dev/pandas/pull/57394
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57394
https://github.com/pandas-dev/pandas/pull/57394
QuLogic
1
I couldn't find a way to specify the endianness when creating the `ArrowDtype`, so just pick the right result based on native byte order. - [x] closes #57373 (Replace xxxx with the GitHub issue number) - [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature - [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). - [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions. - [n/a] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.
[ "Testing", "Arrow" ]
0
0
0
0
0
0
0
0
[ "Sure thanks @QuLogic " ]
2,131,405,003
57,393
TST: Fix IntervalIndex constructor tests on big-endian systems
closed
2024-02-13T03:41:59
2024-02-13T23:20:35
2024-02-13T17:23:46
https://github.com/pandas-dev/pandas/pull/57393
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57393
https://github.com/pandas-dev/pandas/pull/57393
QuLogic
1
Two tests cases specify the expected data to be little-endian. However, none of the other cases do so, and the test creates native endian data, causing these tests to fail only in these specific cases. - [n/a] closes #xxxx (Replace xxxx with the GitHub issue number) - [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature - [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). - [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions. - [n/a] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.
[ "Testing", "Interval" ]
0
0
0
0
0
0
0
0
[ "Thanks @QuLogic " ]
2,131,388,888
57,392
DOC: fix SA05 errors in docstrings
closed
2024-02-13T03:17:47
2024-03-29T06:47:39
2024-02-16T17:24:31
https://github.com/pandas-dev/pandas/issues/57392
true
null
null
jordan-d-murphy
31
Pandas has a script for validating docstrings: https://github.com/pandas-dev/pandas/blob/1d7aedcd19470f689e4db625271802eb49531e80/ci/code_checks.sh#L145-L206 Currently, some methods fail the SA05 check. The task here is: - take 2-4 methods - run: scripts/validate_docstrings.py --format=actions --errors=SA05 `method-name` - check if validation docstrings passes for those methods, and if it’s necessary fix the docstrings according to whatever error is reported - remove those methods from code_checks.sh - commit, push, open pull request - Please don't comment `take` as multiple people can work on this issue. You also don't need to ask for permission to work on this, just comment on which methods are you going to work. If you're new contributor, please check the [contributing guide](https://pandas.pydata.org/docs/dev/development/contributing.html)
[ "Docs", "CI", "good first issue" ]
0
0
0
0
0
0
0
0
[ "I don't have permission to add them, but this could probably use some labels: \r\n\r\n- CI \r\n- Docs\r\n- good first issue\r\n\r\n", "Addresses https://github.com/pandas-dev/pandas/pull/57352", "I'll take \r\n```\r\npandas.DataFrame.agg\r\npandas.DataFrame.aggregate\r\npandas.DataFrame.boxplot\r\n```", "I'll take \r\n```\r\n pandas.PeriodIndex.asfreq\r\n pandas.arrays.ArrowStringArray\r\n pandas.arrays.StringArray\r\n```", "I'll take \r\n`pandas.core.groupby.DataFrameGroupBy.first \r\n pandas.core.groupby.DataFrameGroupBy.last`", "I found a small fix that resolved all of the ExponentialMovingWindow, Expanding, Rolling, and Window SA05 errors (and pandas.plotting.boxplot). \r\n\r\nThis fix takes care of the following: \r\n```\r\npandas.core.window.ewm.ExponentialMovingWindow.corr\r\npandas.core.window.ewm.ExponentialMovingWindow.cov\r\npandas.core.window.ewm.ExponentialMovingWindow.mean\r\npandas.core.window.ewm.ExponentialMovingWindow.std\r\npandas.core.window.ewm.ExponentialMovingWindow.sum\r\npandas.core.window.ewm.ExponentialMovingWindow.var\r\n\r\npandas.core.window.expanding.Expanding.apply\r\npandas.core.window.expanding.Expanding.corr\r\npandas.core.window.expanding.Expanding.count\r\npandas.core.window.expanding.Expanding.cov\r\npandas.core.window.expanding.Expanding.kurt\r\npandas.core.window.expanding.Expanding.max\r\npandas.core.window.expanding.Expanding.mean\r\npandas.core.window.expanding.Expanding.median\r\npandas.core.window.expanding.Expanding.min\r\npandas.core.window.expanding.Expanding.quantile\r\npandas.core.window.expanding.Expanding.rank\r\npandas.core.window.expanding.Expanding.sem\r\npandas.core.window.expanding.Expanding.skew\r\npandas.core.window.expanding.Expanding.std\r\npandas.core.window.expanding.Expanding.sum\r\npandas.core.window.expanding.Expanding.var\r\n\r\npandas.core.window.rolling.Rolling.apply\r\npandas.core.window.rolling.Rolling.corr\r\npandas.core.window.rolling.Rolling.count\r\npandas.core.window.rolling.Rolling.cov\r\npandas.core.window.rolling.Rolling.kurt\r\npandas.core.window.rolling.Rolling.max\r\npandas.core.window.rolling.Rolling.mean\r\npandas.core.window.rolling.Rolling.median\r\npandas.core.window.rolling.Rolling.min\r\npandas.core.window.rolling.Rolling.quantile\r\npandas.core.window.rolling.Rolling.rank\r\npandas.core.window.rolling.Rolling.sem\r\npandas.core.window.rolling.Rolling.skew\r\npandas.core.window.rolling.Rolling.std\r\npandas.core.window.rolling.Rolling.sum\r\npandas.core.window.rolling.Rolling.var\r\n\r\npandas.core.window.rolling.Window.mean\r\npandas.core.window.rolling.Window.std\r\npandas.core.window.rolling.Window.sum\r\npandas.core.window.rolling.Window.var\r\n\r\npandas.plotting.boxplot\r\n```", "I think this is the updated list of what's left: \r\n```\r\n pandas.core.groupby.SeriesGroupBy.first\r\n pandas.core.groupby.SeriesGroupBy.last\r\n pandas.core.resample.Resampler.first\r\n pandas.core.resample.Resampler.last\r\n pandas.core.window.expanding.Expanding.aggregate\r\n pandas.core.window.rolling.Rolling.aggregate\r\n pandas.plotting.bootstrap_plot\r\n pandas.plotting.radviz\r\n```", "Hey @jordan-d-murphy \r\n\r\nI can take SeriesGroupBy : first and last once my previous PR gets merged.", "Awesome! thank you 😊", "Hey @jordan-d-murphy \r\nDo we need to do something before our changes are merged even if all the checks pass?\r\nSomebody reviewed my changes for my above PR but neither merged them nor rejected them. Am I missing something ?\r\n", "@Pistonamey Looks like your PR is merged now, can you check again? \n\nSometimes there might by multiple reviewers on a PR and the first reviewer might add their approval review but leave it for another reviewer to merge. \n\n Looks like that was the case here \n![image](https://github.com/pandas-dev/pandas/assets/35613487/a3f80b0f-d1bf-4b7f-ba92-060121c8b699)\n\nGreat work! Thank you for helping out 🙂", "@jordan-d-murphy \r\n\r\nGot it, Thanks.", "I'll take \r\n```\r\n pandas.core.resample.Resampler.first\r\n pandas.core.resample.Resampler.last\r\n```", "> I'll take\r\n> \r\n> ```\r\n> pandas.core.resample.Resampler.first\r\n> pandas.core.resample.Resampler.last\r\n> ```\r\n\r\nSeems like both are ok, even without changes. I'll just remove these two then.", "Hi @jordan-d-murphy,\r\n\r\nFor \r\n```\r\n pandas.core.window.expanding.Expanding.aggregate\r\n pandas.core.window.rolling.Rolling.aggregate\r\n```\r\nThere is a ES01 -- No extended summary found error. If there a suggested fix to this? \r\nThanks!", "For the ES01 I have opened a PR to get these addressed. See https://github.com/pandas-dev/pandas/pull/57359 \n\nI have a merge conflict to resolve in order to get that merged, and then I'll open an Issue to fix all ES01 errors. (Similar to this issue)\n\nHopefully that will happen later today when I get home from work. I need to do that from my personal laptop. \n\nBut feel free to fix it if you want to! The ultimate goal of All these issues I'm opening is to have correct docstrings for all the functions. I'm segmenting them out to give some structure to the process, but a fully correct docstring for each function is the end goal! \n\n(Typing this from my phone is it's hard to explain the fix for ES01, but when I get back to my personal laptop I'll share more info on those fixes. For PRs opened under this issue it's okay if other errors show up, as long as the SA05 errors are resolved.)", "I'll take\r\n```\r\n pandas.plotting.bootstrap_plot\r\n pandas.plotting.radviz\r\n```", "@williamking1221 https://github.com/pandas-dev/pandas/issues/57440 for ESO1s\r\n", "Thanks @jordan-d-murphy!\r\n\r\nI will pull from main, which as the ignore ES01 checks, and then raise a PR for \r\n```\r\n pandas.core.window.expanding.Expanding.aggregate\r\n pandas.core.window.rolling.Rolling.aggregate\r\n```\r\nDo you have a link to a doc on resolving ES01 issues?", "I believe if this PR goes through, this issue can be closed. ", "@williamking1221 Yeah here's some info on the ES01s from what I understand. \r\n\r\nI'll show two examples to illustrate: \r\nRunning the following `scripts/validate_docstrings.py --format=actions --errors=ES01 pandas.Categorical.map` outputs: \r\n```\r\n################################################################################\r\n################################## Validation ##################################\r\n################################################################################\r\n\r\nDocstring for \"pandas.Categorical.map\" correct. :)\r\n```\r\nand running `scripts/validate_docstrings.py --format=actions --errors=ES01 pandas.Categorical.__array__` outputs \r\n```\r\n################################################################################\r\n################################## Validation ##################################\r\n################################################################################\r\n\r\n3 Errors found for `pandas.Categorical.__array__`:\r\n\tES01\tNo extended summary found\r\n\tPR01\tParameters {'dtype'} not documented\r\n\tSA01\tSee Also section not found\r\n\r\n```\r\nIf we look at the docstrings, we can see a difference: \r\n\r\npandas.Categorical.__array__ (fails with one ES01 - see the higlighted single line summary)\r\n<img width=\"628\" alt=\"Screenshot 2024-02-15 at 5 54 42 PM\" src=\"https://github.com/pandas-dev/pandas/assets/35613487/dc512e63-9c6f-4166-afef-00d4c9f6ba4e\">\r\n\r\npandas.Categorical.map (passes with no ES01 - See highlighted Extended Summary)\r\n<img width=\"722\" alt=\"Screenshot 2024-02-15 at 5 54 00 PM\" src=\"https://github.com/pandas-dev/pandas/assets/35613487/b4d4d777-caa9-4452-9ba4-eca1510c07d1\">\r\n\r\nAdding an extended summary fixes this: \r\n<img width=\"628\" alt=\"Screenshot 2024-02-15 at 5 58 41 PM\" src=\"https://github.com/pandas-dev/pandas/assets/35613487/b4388b8e-43fb-4db4-872e-f7f50e819fdb\">\r\n\r\nupdated output: \r\n```\r\n################################################################################\r\n################################## Validation ##################################\r\n################################################################################\r\n\r\n2 Errors found for `pandas.Categorical.__array__`:\r\n\tPR01\tParameters {'dtype'} not documented\r\n\tSA01\tSee Also section not found\r\n```\r\n\r\nI dont' know if that answers the question, but hopefully that's a start. \r\n\r\nEDIT: I just want to be clear this is an example of *HOW* to resolve the issue, but call out that we shouldn't just start adding meaningless extended summaries in order to pass the checks.\r\n", "@williamking1221 thanks for opening the issue to close this out, I added one comment as a suggestion to ensure the integrity of the SA05 checks", "Hi @jordan-d-murphy \r\n\r\nThanks for this! Btw, is your comment on the PR I raised? ", "yeah if you open [your pr](https://github.com/pandas-dev/pandas/pull/57446) it should show as a review comment", "I don't see it, could you please double check if it went through?\r\n\r\nThanks!", "I tagged you can you see it now?", "Fixed it. Please take a look if this is what we want it to be.\r\nThanks @jordan-d-murphy!", "@williamking1221 What we were talking about was adding SA05 here https://github.com/pandas-dev/pandas/blob/43209e798dd86237a39b667932b4ec438a4ae059/ci/code_checks.sh#L68-L70\r\nwhen we remove the block here https://github.com/pandas-dev/pandas/blob/43209e798dd86237a39b667932b4ec438a4ae059/ci/code_checks.sh#L3185-L3187 ", "> @williamking1221 What we were talking about was adding SA05 here\r\n> \r\n> https://github.com/pandas-dev/pandas/blob/43209e798dd86237a39b667932b4ec438a4ae059/ci/code_checks.sh#L68-L70\r\n> \r\n> \r\n> when we remove the block here\r\n> https://github.com/pandas-dev/pandas/blob/43209e798dd86237a39b667932b4ec438a4ae059/ci/code_checks.sh#L3185-L3187\r\n\r\nAh gotcha! Thanks! Fixed it in recent commit.", "for anyone interested, I've opened some similar issues: \r\n[DOC: fix RT03 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57416)\r\n[DOC: fix SA01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57417)\r\n[DOC: fix PR07 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57420)\r\n[DOC: fix PR01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57438)\r\n[DOC: fix ES01 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57440)\r\n[DOC: fix GL08 errors in docstrings](https://github.com/pandas-dev/pandas/issues/57443)" ]
2,131,285,134
57,391
Fix evaluations on Python 3.12
closed
2024-02-13T01:11:53
2024-08-21T17:44:33
2024-08-21T17:44:32
https://github.com/pandas-dev/pandas/pull/57391
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57391
https://github.com/pandas-dev/pandas/pull/57391
QuLogic
3
List comprehensions no longer get their own scope [1], so adding a level to the (eventual) call to `sys._getframe` goes outside the actual caller. If running in `pytest` (so that there is a scope outside the caller), you end up looking in some unrelated scope. If you are running a script, then `sys._getframe` raises an error that the level is out of bounds. The `Bitwise operations` warning in `test_scalar_unary` appears to always be raised, so remove the condition. [1] https://docs.python.org/3.12/whatsnew/3.12.html#whatsnew312-pep709 I'm not entirely sure why neither issue is seen on CI, but there are so many tests/workflows, I'm also not sure which one to check. I guess I'll see how this goes in this PR. - [n/a] closes #xxxx (Replace xxxx with the GitHub issue number) - [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature - [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). - [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions. - [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.
[ "Testing", "Stale", "Python 3.12" ]
0
0
0
0
0
0
0
0
[ "OK, so tests on CI are failing with the change to the warning condition. _However_, if you check [the logs for `main`](https://github.com/pandas-dev/pandas/actions/runs/7880360042/job/21502267281#step:8:51), it seems like the warning is raised, but from a weird spot that isn't caught:\r\n```\r\n/home/runner/micromamba/envs/test/lib/python3.12/site-packages/coverage/parser.py:402: DeprecationWarning: Bitwise inversion '~' on bool is deprecated. This returns the bitwise inversion of the underlying int object and is usually not what you expect from negating a bool. Use the 'not' operator for boolean negation or ~int(x) if you really want the bitwise inversion of the underlying int.\r\n self.code = compile(text, filename, \"exec\", dont_inherit=True)\r\n```", "This pull request is stale because it has been open for thirty days with no activity. Please [update](https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#updating-your-pull-request) and respond to this comment if you're still interested in working on this.", "Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen." ]
2,131,268,421
57,390
BUG: Identity checking NA in `map` is incorrect
open
2024-02-13T00:59:36
2025-08-17T02:22:55
null
https://github.com/pandas-dev/pandas/issues/57390
true
null
null
mroeschke
4
```python In [2]: pd.Series([pd.NA], dtype="Int64").map(lambda x: 1 if x is pd.NA else 2) Out[2]: 0 2 dtype: int64 ``` In pandas 2.1 ```python In [2]: pd.Series([pd.NA], dtype="Int64").map(lambda x: 1 if x is pd.NA else 2) Out[2]: 0 1 ``` This is probably because we call `to_numpy` before going through `map_array`
[ "Regression", "Apply", "NA - MaskedArrays", "Arrow" ]
0
0
0
0
0
0
0
0
[ "I hit the same issue in 2.2.0, based on https://github.com/pandas-dev/pandas/issues/56606#issuecomment-1871319732, it was mentioned this was the expected behavior going forward. Is this no longer the case?", "Ah thanks @rohanjain101, I didn't realized you opened https://github.com/pandas-dev/pandas/issues/56606\r\n\r\nI would say in an ideal world `pd.NA` still shouldn't get coerced to `np.nan` when evaluating a UDF (and without going through object)", "take", "Hi @mroeschke : for information I created a PR (https://github.com/pandas-dev/pandas/pull/58392) \r\n\r\nThe idea is just to avoid that `pd.NA` value are converted to `np.nan` by calling `to_numpy`: `pd.NA` values stay `pd.NA` values after a `map` operation\r\n\r\nThat's why `test_map` and `test_map_na_action_ignore` were modified in this way (we expect in this modified tests to keep `pd.NA` after a `map`)\r\n\r\nWould it be acceptable to manage this problem in this way ?" ]
2,131,268,206
57,389
TST: Ensure Matplotlib is always cleaned up
closed
2024-02-13T00:59:30
2024-02-13T03:18:26
2024-02-13T02:54:54
https://github.com/pandas-dev/pandas/pull/57389
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57389
https://github.com/pandas-dev/pandas/pull/57389
QuLogic
1
The seaborn test also uses Matplotlib but was not wrapped in the cleanup fixture, As there are now 3 files that need this fixture, refactor to reduce code duplication. The leftover figure from `test_seaborn` would cause a DeprecationWarning from Matplotlib 3.8 for closing the figures on the backend change (from the `mpl.use("template")` in the fixture), but this probably depends on if pytest chose to run it before the other tests or not. - [n/a] closes #xxxx (Replace xxxx with the GitHub issue number) - [x] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature - [x] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit). - [n/a] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions. - [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.
[ "Testing" ]
0
0
0
0
0
0
0
0
[ "Thanks @QuLogic " ]
2,131,258,270
57,388
BUG: map(na_action=ignore) not respected for Arrow & masked types
closed
2024-02-13T00:52:13
2024-02-14T02:11:13
2024-02-14T00:49:24
https://github.com/pandas-dev/pandas/pull/57388
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57388
https://github.com/pandas-dev/pandas/pull/57388
mroeschke
1
```python In [5]: df = DataFrame({"a": [1, NA, 2], "b": [NA, 4, NA]}, dtype="Int64") In [6]: df.map(lambda x: 42, na_action="ignore") # pd.NA's lost Out[6]: a b 0 42 42 1 42 42 2 42 42 ```
[ "NA - MaskedArrays", "Arrow" ]
0
0
0
0
0
0
0
0
[ "thx @mroeschke " ]
2,131,114,459
57,387
CLN: Python 2 pickle/hdf support
closed
2024-02-12T22:40:44
2024-02-14T02:10:51
2024-02-14T00:48:13
https://github.com/pandas-dev/pandas/pull/57387
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57387
https://github.com/pandas-dev/pandas/pull/57387
mroeschke
1
xref https://github.com/pandas-dev/pandas/pull/57155
[ "IO HDF5", "IO Pickle" ]
0
0
0
0
0
0
0
0
[ "thx @mroeschke " ]
2,131,055,868
57,386
BUG: assert_index_equal defaults to check_exact_index=False on integers
closed
2024-02-12T21:57:59
2024-04-24T16:18:04
2024-04-24T16:18:04
https://github.com/pandas-dev/pandas/issues/57386
true
null
null
rhshadrach
2
Ref: https://github.com/pandas-dev/pandas/pull/57341#discussion_r1486812938
[ "Bug", "Testing", "API - Consistency" ]
0
0
0
0
0
0
0
0
[ "Sorry but I don't understand what the bug is from the title, looking at `assert_index_equal`'s parameters I can see that `check_exact` always defaults to `True`\r\nLooking at the comment, maybe you meant that `check_exact_index` in `assert_series_equal` defaults to `False` for integers? ", "> maybe you meant that `check_exact_index` in `assert_series_equal` defaults to `False` for integers?\r\n\r\nYes - thanks." ]
2,131,043,734
57,385
CLN: ._data, PeriodIndex arguments
closed
2024-02-12T21:49:32
2024-02-14T17:43:57
2024-02-14T17:43:54
https://github.com/pandas-dev/pandas/pull/57385
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57385
https://github.com/pandas-dev/pandas/pull/57385
mroeschke
1
xref https://github.com/pandas-dev/pandas/pull/52003, https://github.com/pandas-dev/pandas/pull/55963 Bumped fastparquet as they updated their `_data` usage in https://github.com/dask/fastparquet/commit/7d9703b82090c5fc8ae3b013ae558f3b06fa287c
[ "Clean" ]
0
0
0
0
0
0
0
0
[ "Going to merge but can follow up if needed" ]
2,130,988,210
57,384
DOC: add an example to `PeriodIndex.to_timestamp` to clarify the behavior in case len(index)<3
closed
2024-02-12T21:10:29
2024-02-15T16:09:12
2024-02-15T16:09:12
https://github.com/pandas-dev/pandas/pull/57384
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57384
https://github.com/pandas-dev/pandas/pull/57384
natmokval
1
xref #56213 added an example to `PeriodIndex.to_timestamp` to clarify the behavior in case `len(index) < 3`
[ "Docs" ]
0
0
0
0
0
0
0
0
[ "@MarcoGorelli, I added an example to clarify the behavior of `PeriodIndex.to_timestamp` in case `len(index) < 3`. Could you please take a look at this PR?" ]
2,130,938,042
57,383
Backport PR #57379 on branch 2.2.x (Fix numpy-dev CI warnings)
closed
2024-02-12T20:33:11
2024-02-12T21:50:47
2024-02-12T21:50:47
https://github.com/pandas-dev/pandas/pull/57383
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57383
https://github.com/pandas-dev/pandas/pull/57383
meeseeksmachine
0
Backport PR #57379: Fix numpy-dev CI warnings
[ "CI", "IO JSON", "Compat" ]
0
0
0
0
0
0
0
0
[]
2,130,771,561
57,382
DOC: `is_interval` is deprecated, but not in the docs
closed
2024-02-12T19:03:40
2024-02-19T20:15:25
2024-02-19T20:15:25
https://github.com/pandas-dev/pandas/issues/57382
true
null
null
Dr-Irv
0
### 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/pandas-docs/stable/reference/api/pandas.api.types.is_interval.html ### Documentation problem This page should show that `is_interval` is deprecated as of v2.2. ### Suggested fix for documentation This page should show that `is_interval` is deprecated as of v2.2.
[ "Docs", "Blocker" ]
0
0
0
0
0
0
0
0
[]
2,130,712,725
57,381
Backport PR #57340 on branch 2.2.x (REGR: shift raising for axis=1 and empty df)
closed
2024-02-12T18:25:35
2024-02-12T20:33:27
2024-02-12T20:33:27
https://github.com/pandas-dev/pandas/pull/57381
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57381
https://github.com/pandas-dev/pandas/pull/57381
meeseeksmachine
0
Backport PR #57340: REGR: shift raising for axis=1 and empty df
[ "DataFrame" ]
0
0
0
0
0
0
0
0
[]
2,130,710,372
57,380
Backport PR #57341 on branch 2.2.x (REGR: assert_series_equal defaulting to check_exact=True for Index)
closed
2024-02-12T18:23:50
2024-02-12T20:33:19
2024-02-12T20:33:18
https://github.com/pandas-dev/pandas/pull/57380
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57380
https://github.com/pandas-dev/pandas/pull/57380
meeseeksmachine
0
Backport PR #57341: REGR: assert_series_equal defaulting to check_exact=True for Index
[ "Testing", "Regression" ]
0
0
0
0
0
0
0
0
[]
2,130,700,825
57,379
Fix numpy-dev CI warnings
closed
2024-02-12T18:18:43
2024-02-12T20:33:11
2024-02-12T20:33:04
https://github.com/pandas-dev/pandas/pull/57379
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57379
https://github.com/pandas-dev/pandas/pull/57379
WillAyd
1
null
[ "CI", "IO JSON", "Compat" ]
0
0
0
0
0
0
0
0
[ "Thanks @WillAyd " ]
2,129,731,875
57,378
ENH: ordered_fillna() to sequentially fillna a single column/Series with multiple possible values
closed
2024-02-12T09:33:55
2024-02-13T09:32:34
2024-02-13T09:32:33
https://github.com/pandas-dev/pandas/issues/57378
true
null
null
vivianleung
6
### Feature Type - [X] Adding new functionality to pandas - [ ] Changing existing functionality in pandas - [ ] Removing existing functionality in pandas ### Problem Description I wish I could dynamically apply fillna to a DataFrame column or Series using a sequence of multiple Series and/or column labels in a more efficient way, particularly in place and if I have a lot of fillna values/options. For example, if given a DataFrame `df`: ``` name place region country Alice Boston MA NaN Bob NaN NY USA Charlie NaN NaN Canada Doug NaN NaN NaN ``` and Series `ser`: ``` Doug London dtype: object ``` Instead of ``` df.fillna({'place': df['region']}, inplace=True) df.fillna({'place': df['country'], inplace=True) df.fillna({'place': ser}, inplace=True) ``` I could do `df.ordered_fillna(['region', 'country', ser], label='place', inplace=True)` to get ``` name place region country Alice Boston MA NaN Bob NY NY USA Charlie Canada NaN Canada Doug London NaN NaN ``` This is useful when I have a Series/DataFrame with many missing values, and would like to have one consolidated column filled with some available information (in a prioritized/ordered way). Not sure if this feature would be helpful to add or if I should make a pull request—it's something I'd been working on and wanted to share! ### Feature Description Code: (Note that it still needs to be fully tested.) This only does across index, but could be theoretically done for across columns too. ```python def ordered_fillna( obj, values: Hashable | Collection[Hashable] | Series | DataFrame = ..., label: Hashable = None, *, inplace: bool = False, method: FillnaOptions | Collection[FillnaOptions] | None = None, # axis: Axis | None = None, limit: int | Collection[int] | None = None, downcast: ( dict | None | lib.NoDefault | Collection[dict, None, lib.NoDefault] ) = lib.no_default, ) -> Series | DataFrame | None: """Progressive fillna according to an ordered `order` list Parameters ---------- obj: Series or DataFrame values : column label or Series or column-ordered DataFrame or list-like or dict of column labels and/or Series objects Column(s) (from obj) or value(s) by which to fill obj column label: Hashable Column label to fill (if obj is a DataFrame) inplace: bool, optional Do fillna in place method: single kwarg or collection of kwargs to map to `values` limit: single kwarg or collection of kwargs to map to `values` downcast: single kwarg or collection of kwargs to map to `values` Returns ------- pd.DataFrame or None """ if not inplace: obj = obj.copy() # or something like this # single column label or Series, equivalent to obj.fillna if isinstance(values, (Hashable, Series)): fillna_kws = dict(inplace=True, method=method, limit=limit, downcast=downcast) # get column from obj (DataFrame) if isinstance(values, Hashable): obj.fillna({label: obj[values]}, **fillna_kws) elif isinstance(obj, DataFrame): obj.fillna({label: values}, **fillna_kws) else: obj.fillna(values, **fillna_kws) # multiple values items for filling else: # construct keyword dicts to map to each item in `values` # `method` kwarg if isinstance(method, str) or method is None: methods = [method for _ in values] elif isinstance(values, (DataFrame, Mapping)): # make list according to key/col order methods = [method[col] for col in method] elif not isinstance(method, Mapping): methods = method # `values` must also be list-like else: # assumed in order methods = method.values() # `limit` kwarg if isinstance(limit, int) or limit is None: limits = [limit for _ in values] elif isinstance(values, (DataFrame, Mapping)): # make list according to key/col order limits = [limit[col] for col in limit] elif not isinstance(limit, Mapping): limits = limit # `values` must also be list-like else: # assumed in order limits = limit.values() # `downcast` kwarg if downcast in (lib.no_default, None): downcasts = [downcast for _ in values] elif isinstance(values, (DataFrame, Mapping)): # make list according to key/col order downcasts = [downcast[col] for col in downcast] elif not isinstance(downcast, Mapping): downcasts = downcast # `values` must also be list-like else: # assumed in order downcasts = downcast.values() # make `values` as (ordered) list of items for filling if isinstance(values, (DataFrame, Mapping)): # get values by column/key values_iter = [values[col] for col in values] else: # list of column labels and/or Series values_iter = [obj[v] if isinstance(v, Hashable) else v for v in values] # iterate through values. if isinstance(obj, DataFrame): for val, meth, lim, down in zip(values_iter, methods, limits, downcasts): obj.fillna( {label: val}, inplace=True, method=meth, limit=lim, downcast=down, ) else: # obj is a Series for col, meth, lim, down in zip(values_iter, methods, limits, downcasts): obj.fillna( val, inplace=True, method=meth, limit=lim, downcast=down, ) # return if not inplace: return obj ``` Example: ```python >>> data = pd.DataFrame.from_dict( ... { ... 'Alice': {'place': 'Boston', 'region': 'MA',}, ... 'Bob': {'region': 'NY', 'country': 'USA'}, ... 'Charlie': {'country': 'Canada'}, ... 'Doug': {'country': None} ... }, ... orient='index' ... ) >>> data place region country Alice Boston MA NaN Bob NaN NY USA Charlie NaN NaN Canada Doug NaN NaN None >>> ser = pd.Series({'Doug': 'London'}) >>> ser Doug London dtype: object >>> data.ordered_fillna([ser, 'region', 'country'], 'place', inplace=True) >>> data place region country Alice Boston MA NaN Bob NY NY USA Charlie Canada NaN Canada Doug London NaN None ``` ### Alternative Solutions N/A ### Additional Context _No response_
[ "Enhancement", "Needs Triage" ]
0
0
0
0
0
0
0
0
[ "Why can't you just do\r\n\r\n```\r\ndf.loc[df.x.isna(), \"x\"] = ordered_sequence\r\n```\r\n\r\n?\r\n", "Thanks for your response! \r\n\nIn your example, is `ordered_sequence` a sequence of values, i.e. only one value/option is given for each (null) value in the slice? Or multiple options?\n\r\nBy ordered sequence I mean an ordered sequence of possible fallback/default values, i.e. in the example, \r\n\r\nif `place` is null, then use the value in the `region` column, but if that `region` value is also null, use the value in the `country` column. \r\n\r\n", "I suppose it could all be done with a chain of 'fillna's, but one advantage would be avoiding copying large dataframes? I'm not completely sure how it works under the hood. 😅 ", "> By ordered sequence I mean an ordered sequence of possible fallback/default values, i.e. in the example,\r\n\r\n> if place is null, then use the value in the region column, but if that region value is also null, use the value in the country column.\r\n\r\nso you are looking for some kind of coalesce? Combine_first is the solution for this \r\n\r\nthe method sounds very complicated fwiw and something that you can achieve with reasonable effort with other methods ", "Ohh interesting, sorry, didn't know this existed—this is really helpful. Thank you! ", "closing his one then" ]
2,129,706,199
57,377
BUG: Inconsistent "is_year_start" from DatetimeIndex with freq "MS"
closed
2024-02-12T09:18:17
2024-05-02T10:14:06
2024-05-02T10:14:06
https://github.com/pandas-dev/pandas/issues/57377
true
null
null
pforero
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 pandas as pd dr = pd.date_range("2017-12-01", periods=2, freq="MS") dr_comp = [dt.is_year_start for dt in dr] dr_attr = dr.is_year_start assert dr[1].is_year_start assert dr_comp[1] assert dr_attr[0] # Should raise error but doesn't assert dr_attr[1] # Raises error but shouldn't ``` ### Issue Description When working with DatetimeIndex with frequency "MS" the attribute "is_year_start" does not obtain the same attribute if you obtain the attribute directly from the DatatimeIndex instead of obtaining directly from each individual value of the DatetimeIndex. ### Expected Behavior I would expect for the same array of attributes independently of if it is obtained from a comprehensive list or as an attibute as shown in the documentation. https://pandas.pydata.org/docs/reference/api/pandas.DatetimeIndex.is_year_start.html ```python import pandas as pd dr = pd.date_range("2017-12-01", periods=2, freq="MS") dr_comp = [dt.is_year_start for dt in dr] dr_attr = dr.is_year_start assert not dr[1].is_year_start assert dr[1].is_year_start assert not dr_comp[1] assert dr_comp[1] assert not dr_attr[0] assert dr_attr[1] ``` ### Installed Versions <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.11.6.final.0 python-bits : 64 OS : Linux OS-release : 3.10.0-1160.95.1.el7.x86_64 Version : #1 SMP Fri Jun 23 08:44:55 EDT 2023 machine : x86_64 processor : x86_64 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.4 pytz : 2024.1 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.2.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.16.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 : 3.1.2 pandas_gbq : None pyarrow : None pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : 2.0.21 tables : None tabulate : None xarray : None xlrd : None zstandard : None tzdata : 2023.4 qtpy : None pyqt5 : None </details>
[ "Bug", "datetime.date" ]
0
0
0
0
0
0
0
0
[ "Thanks for the report. Confirmed on main, further investigations and PRs to fix are welcome!", "take", "Upon further inspection, it looks like is_quarter_start with the freq 'MS' is having the same issue\r\n```python\r\nidx = pd.date_range('2017-01-01', periods=6, freq='MS')\r\nidx[idx.is_quarter_start]\r\n```\r\nThis gives the dates 2017-03-01 and 2017-06-01, which are of course not the actual start of quarters", "looks like this was already reported earlier: https://github.com/pandas-dev/pandas/issues/49606" ]
2,129,632,607
57,376
Bump pre-commit/action from 3.0.0 to 3.0.1
closed
2024-02-12T08:28:08
2024-02-12T16:58:23
2024-02-12T16:58:20
https://github.com/pandas-dev/pandas/pull/57376
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57376
https://github.com/pandas-dev/pandas/pull/57376
dependabot[bot]
0
Bumps [pre-commit/action](https://github.com/pre-commit/action) from 3.0.0 to 3.0.1. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/pre-commit/action/releases">pre-commit/action's releases</a>.</em></p> <blockquote> <h2>pre-commit/[email protected]</h2> <h3>Misc</h3> <ul> <li>Update actions/cache to v4 <ul> <li><a href="https://redirect.github.com/pre-commit/action/issues/190">#190</a> PR by <a href="https://github.com/SukiCZ"><code>@​SukiCZ</code></a>.</li> <li><a href="https://redirect.github.com/pre-commit/action/issues/189">#189</a> issue by <a href="https://github.com/bakerkj"><code>@​bakerkj</code></a>.</li> </ul> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/pre-commit/action/commit/2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd"><code>2c7b380</code></a> v3.0.1</li> <li><a href="https://github.com/pre-commit/action/commit/8e2deebc7918860122d0968e9e4fb73161fedbe2"><code>8e2deeb</code></a> Merge pull request <a href="https://redirect.github.com/pre-commit/action/issues/190">#190</a> from SukiCZ/upgrade-action/cache-v4</li> <li><a href="https://github.com/pre-commit/action/commit/0dbc303468d9ee1ae3a4cddd9b697c1424c73522"><code>0dbc303</code></a> Upgrade action/cache to v4. Fixes: <a href="https://redirect.github.com/pre-commit/action/issues/189">#189</a></li> <li><a href="https://github.com/pre-commit/action/commit/c7d159c2092cbfaab7352e2d8211ab536aa2267c"><code>c7d159c</code></a> Merge pull request <a href="https://redirect.github.com/pre-commit/action/issues/185">#185</a> from pre-commit/asottile-patch-1</li> <li><a href="https://github.com/pre-commit/action/commit/9dd42377a1725fb44b57b6a17501d984852f8ad9"><code>9dd4237</code></a> fix main badge</li> <li><a href="https://github.com/pre-commit/action/commit/37faf8a587e18fa3a3f78f600c9edbfd0691c3c3"><code>37faf8a</code></a> Merge pull request <a href="https://redirect.github.com/pre-commit/action/issues/184">#184</a> from pre-commit/pre-commit-ci-update-config</li> <li><a href="https://github.com/pre-commit/action/commit/049686ec527b5f1785b9cafcb3258821878466b1"><code>049686e</code></a> [pre-commit.ci] pre-commit autoupdate</li> <li><a href="https://github.com/pre-commit/action/commit/5f528da5c95691c4cf42ff76a4d10854b62cbb82"><code>5f528da</code></a> move back to maintenance-only</li> <li><a href="https://github.com/pre-commit/action/commit/efd3bcfec120bd343786e46318186153b7bc8c68"><code>efd3bcf</code></a> Merge pull request <a href="https://redirect.github.com/pre-commit/action/issues/170">#170</a> from pre-commit/pre-commit-ci-update-config</li> <li><a href="https://github.com/pre-commit/action/commit/df308c7f46bfa147cdec6c9795d030dc13431d35"><code>df308c7</code></a> [pre-commit.ci] pre-commit autoupdate</li> <li>Additional commits viewable in <a href="https://github.com/pre-commit/action/compare/v3.0.0...v3.0.1">compare view</a></li> </ul> </details> <br /> [![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pre-commit/action&package-manager=github_actions&previous-version=3.0.0&new-version=3.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details>
[ "CI", "Dependencies" ]
0
0
0
0
0
0
0
0
[]
2,129,382,701
57,375
DEPR: Positional arguments in Series.to_string
closed
2024-02-12T04:03:04
2024-02-17T17:14:36
2024-02-17T13:11:08
https://github.com/pandas-dev/pandas/pull/57375
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57375
https://github.com/pandas-dev/pandas/pull/57375
rmhowe425
6
- [X] closes #57280 - [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.
[ "IO Data", "Deprecate" ]
0
0
0
0
0
0
0
0
[ "@mroeschke Pinging on green", "Looking good! You can already make the two overloads keyword-only, if you want to:\r\n\r\n```py\r\n @overload\r\n def to_string(\r\n self,\r\n buf: None = ...,\r\n *,\r\n na_rep: str = ...,\r\n```", "@twoertwein It looks like the two overloaded methods are already keyword only. Is there something specific I need to do?", "> Is there something specific I need to do?\r\n\r\nJust need to add two `*,`\r\n\r\n```py\r\n @overload\r\n def to_string(\r\n self,\r\n buf: None = ...,\r\n *, # add this\r\n na_rep: str = ...,\r\n\r\n @overload\r\n def to_string(\r\n self,\r\n buf: FilePath | WriteBuffer[str],\r\n *, # add this\r\n na_rep: str = ...,\r\n\r\n @deprecate_nonkeyword_arguments(\r\n def to_string(\r\n```", "@twoertwein Pinging on green. \r\n\r\nBTW I didn't know that you can use `*` to mandate the use of keyword args after the `*`. I learned something new today!", "Thank you @rmhowe425 !\r\n" ]
2,129,378,611
57,374
update intiger_na.rst document file
closed
2024-02-12T03:56:52
2024-02-12T17:08:50
2024-02-12T17:08:49
https://github.com/pandas-dev/pandas/pull/57374
true
https://api.github.com/repos/pandas-dev/pandas/pulls/57374
https://github.com/pandas-dev/pandas/pull/57374
codeoxygen
2
- [x] closes #49201 - [ ] [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
[ "pre-commit.ci autofix", "Thanks for the PR but this is actively being worked on in https://github.com/pandas-dev/pandas/pull/57050 so closing in favor of that open PR. Can reopen this one if the other one goes stale" ]
2,129,330,935
57,373
BUG: test_str_encode[utf32] fails on big-endian machine
closed
2024-02-12T02:41:06
2024-02-13T17:09:53
2024-02-13T17:09:53
https://github.com/pandas-dev/pandas/issues/57373
true
null
null
QuLogic
0
The `test_str_encode` test here: https://github.com/pandas-dev/pandas/blob/4e40afd9d9a6206a1cab83b4fdb0365cd739f576/pandas/tests/extension/test_arrow.py#L2171-L2183 appears to encode to _native_ byte order, but the expected value `b"\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00"` is given in _little-endian_ order. This causes the test to fail on big-endian systems such as s390x: ``` E AssertionError: Series are different E E Series values are different (100.0 %) E [index]: [0, 1] E [left]: [b'\x00\x00\xfe\xff\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c'] E [right]: [b'\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00'] E At positional index 0, first diff: b'\x00\x00\xfe\xff\x00\x00\x00a\x00\x00\x00b\x00\x00\x00c' != b'\xff\xfe\x00\x00a\x00\x00\x00b\x00\x00\x00c\x00\x00\x00' testing.pyx:173: AssertionError ``` <details> INSTALLED VERSIONS ------------------ commit : f538741432edf55c6b9fb5d0d496d2dd1d7c2457 python : 3.12.2.final.0 python-bits : 64 OS : Linux OS-release : 6.6.11-200.fc39.x86_64 Version : #1 SMP PREEMPT_DYNAMIC Wed Jan 10 19:25:59 UTC 2024 machine : x86_64 processor : byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : C.UTF-8 pandas : 2.2.0 numpy : 1.26.2 pytz : 2024.1 dateutil : 2.8.2 setuptools : 69.0.3 pip : 23.3.2 Cython : 3.0.8 pytest : 7.4.3 hypothesis : 6.96.1 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 : 0.10.0 adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : 4.12.3 bottleneck : 1.3.7 dataframe-api-compat : None fastparquet : None fsspec : 2024.2.0 gcsfs : 2023.6.0+1.g7cc53d9 matplotlib : 3.8.2 numba : None numexpr : 2.8.5 odfpy : None openpyxl : 3.1.2 pandas_gbq : None pyarrow : 15.0.0 pyreadstat : None python-calamine : None pyxlsb : None s3fs : None scipy : 1.11.3 sqlalchemy : 2.0.25 tables : 3.9.2 tabulate : 0.9.0 xarray : 2023.8.0 xlrd : 2.0.1 zstandard : 0.22.0 tzdata : None qtpy : 2.4.1 pyqt5 : None </details>
[ "Testing", "Arrow" ]
0
0
0
0
0
0
0
0
[]