Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add sort_labels performance tip in docstrings
  • Loading branch information
TLouf committed Aug 24, 2021
commit 14cb2ccfd1ee3ba7923cb8d21bccef00b146a288
2 changes: 2 additions & 0 deletions pandas/core/arrays/sparse/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def to_coo(self, row_levels=(0,), column_levels=(1,), sort_labels=False):
column_levels : tuple/list
sort_labels : bool, default False
Sort the row and column labels before forming the sparse matrix.
When `row_levels` and/or `column_levels` refer to a single level,
set to `True` for a faster execution.

Returns
-------
Expand Down
5 changes: 4 additions & 1 deletion pandas/core/arrays/sparse/scipy_sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def _levels_to_axis(
valid_ilocs : numpy.ndarray
Array of integer positions of valid values for the sparse matrix in ss.
sort_labels : bool, default False
Sort the axis labels before forming the sparse matrix.
Sort the axis labels before forming the sparse matrix. When `levels`
refers to a single level, set to True for a faster execution.

Returns
-------
Expand Down Expand Up @@ -104,6 +105,8 @@ def _to_ijv(
column_levels : tuple/list
sort_labels : bool, default False
Sort the row and column labels before forming the sparse matrix.
When `row_levels` and/or `column_levels` refer to a single level,
set to `True` for a faster execution.

Returns
-------
Expand Down