Skip to content

Commit d34381f

Browse files
Merge branch 'main' into change-closed-docs
2 parents ff17ffc + 68569a6 commit d34381f

File tree

6 files changed

+57
-15
lines changed

6 files changed

+57
-15
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,7 @@ Reshaping
766766
- Bug in :meth:`DataFrame.unstack` producing incorrect results when ``sort=False`` (:issue:`54987`, :issue:`55516`)
767767
- Bug in :meth:`DataFrame.merge` when merging two :class:`DataFrame` on ``intc`` or ``uintc`` types on Windows (:issue:`60091`, :issue:`58713`)
768768
- Bug in :meth:`DataFrame.pivot_table` incorrectly subaggregating results when called without an ``index`` argument (:issue:`58722`)
769+
- Bug in :meth:`DataFrame.stack` with the new implementation where ``ValueError`` is raised when ``level=[]`` (:issue:`60740`)
769770
- Bug in :meth:`DataFrame.unstack` producing incorrect results when manipulating empty :class:`DataFrame` with an :class:`ExtentionDtype` (:issue:`59123`)
770771

771772
Sparse

pandas/core/frame.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,9 +3205,13 @@ def to_html(
32053205
Convert the characters <, >, and & to HTML-safe sequences.
32063206
notebook : {True, False}, default False
32073207
Whether the generated HTML is for IPython Notebook.
3208-
border : int
3209-
A ``border=border`` attribute is included in the opening
3210-
`<table>` tag. Default ``pd.options.display.html.border``.
3208+
border : int or bool
3209+
When an integer value is provided, it sets the border attribute in
3210+
the opening tag, specifying the thickness of the border.
3211+
If ``False`` or ``0`` is passed, the border attribute will not
3212+
be present in the ``<table>`` tag.
3213+
The default value for this parameter is governed by
3214+
``pd.options.display.html.border``.
32113215
table_id : str, optional
32123216
A css id is included in the opening `<table>` tag if specified.
32133217
render_links : bool, default False

pandas/core/reshape/reshape.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,8 @@ def _reorder_for_extension_array_stack(
929929
def stack_v3(frame: DataFrame, level: list[int]) -> Series | DataFrame:
930930
if frame.columns.nunique() != len(frame.columns):
931931
raise ValueError("Columns with duplicate values are not supported in stack")
932+
if not len(level):
933+
return frame
932934
set_levels = set(level)
933935
stack_cols = frame.columns._drop_level_numbers(
934936
[k for k in range(frame.columns.nlevels - 1, -1, -1) if k not in set_levels]

pandas/io/formats/format.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -897,9 +897,13 @@ def to_html(
897897
``<table>`` tag, in addition to the default "dataframe".
898898
notebook : {True, False}, optional, default False
899899
Whether the generated HTML is for IPython Notebook.
900-
border : int
901-
A ``border=border`` attribute is included in the opening
902-
``<table>`` tag. Default ``pd.options.display.html.border``.
900+
border : int or bool
901+
When an integer value is provided, it sets the border attribute in
902+
the opening tag, specifying the thickness of the border.
903+
If ``False`` or ``0`` is passed, the border attribute will not
904+
be present in the ``<table>`` tag.
905+
The default value for this parameter is governed by
906+
``pd.options.display.html.border``.
903907
table_id : str, optional
904908
A css id is included in the opening `<table>` tag if specified.
905909
render_links : bool, default False

pandas/tests/frame/test_stack_unstack.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,6 +1452,25 @@ def test_stack_empty_frame(dropna, future_stack):
14521452
tm.assert_series_equal(result, expected)
14531453

14541454

1455+
@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated")
1456+
@pytest.mark.parametrize("dropna", [True, False, lib.no_default])
1457+
def test_stack_empty_level(dropna, future_stack, int_frame):
1458+
# GH 60740
1459+
if future_stack and dropna is not lib.no_default:
1460+
with pytest.raises(ValueError, match="dropna must be unspecified"):
1461+
DataFrame(dtype=np.int64).stack(dropna=dropna, future_stack=future_stack)
1462+
else:
1463+
expected = int_frame
1464+
result = int_frame.copy().stack(
1465+
level=[], dropna=dropna, future_stack=future_stack
1466+
)
1467+
tm.assert_frame_equal(result, expected)
1468+
1469+
expected = DataFrame()
1470+
result = DataFrame().stack(level=[], dropna=dropna, future_stack=future_stack)
1471+
tm.assert_frame_equal(result, expected)
1472+
1473+
14551474
@pytest.mark.filterwarnings("ignore:The previous implementation of stack is deprecated")
14561475
@pytest.mark.parametrize("dropna", [True, False, lib.no_default])
14571476
@pytest.mark.parametrize("fill_value", [None, 0])

web/pandas/community/ecosystem.md

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -496,17 +496,29 @@ You can find more information about the Hugging Face Dataset Hub in the [documen
496496

497497
## Out-of-core
498498

499-
### [Bodo](https://bodo.ai/)
499+
### [Bodo](https://github.com/bodo-ai/Bodo)
500500

501-
Bodo is a high-performance Python computing engine that automatically parallelizes and
502-
optimizes your code through compilation using HPC (high-performance computing) techniques.
503-
Designed to operate with native pandas dataframes, Bodo compiles your pandas code to execute
504-
across multiple cores on a single machine or distributed clusters of multiple compute nodes efficiently.
505-
Bodo also makes distributed pandas dataframes queryable with SQL.
506501

507-
The community edition of Bodo is free to use on up to 8 cores. Beyond that, Bodo offers a paid
508-
enterprise edition. Free licenses of Bodo (for more than 8 cores) are available
509-
[upon request](https://www.bodo.ai/contact) for academic and non-profit use.
502+
Bodo is a high-performance compute engine for Python data processing.
503+
Using an auto-parallelizing just-in-time (JIT) compiler, Bodo simplifies scaling Pandas
504+
workloads from laptops to clusters without major code changes.
505+
Under the hood, Bodo relies on MPI-based high-performance computing (HPC) technology—making it
506+
both easier to use and often much faster than alternatives.
507+
Bodo also provides a SQL engine that can query distributed pandas dataframes efficiently.
508+
509+
```python
510+
import pandas as pd
511+
import bodo
512+
513+
@bodo.jit
514+
def process_data():
515+
df = pd.read_parquet("my_data.pq")
516+
df2 = pd.DataFrame({"A": df.apply(lambda r: 0 if r.A == 0 else (r.B // r.A), axis=1)})
517+
df2.to_parquet("out.pq")
518+
519+
process_data()
520+
```
521+
510522

511523
### [Cylon](https://cylondata.org/)
512524

0 commit comments

Comments
 (0)