當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python cudf.Series.sort_values用法及代碼示例

用法:

Series.sort_values(axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last', ignore_index=False)

按任一軸上的值排序。

參數

ascendingbool 或 bool 列表,默認為 True

升序與降序排序。指定多個排序順序的列表。如果這是一個布爾列表,則必須匹配 by 的長度。

na_position{‘first’, ‘last’},默認 ‘last’

‘first’ 將空值放在開頭,‘last’ 將空值放在末尾

ignore_index布爾值,默認為 False

如果為 True,則不會對索引進行排序。

返回

Series具有排序值的係列。

注意

與 Pandas 的區別:
  • 僅支持axis='index'。
  • 不支持:就地,善良

例子

>>> import cudf
>>> s = cudf.Series([1, 5, 2, 4, 3])
>>> s.sort_values()
0    1
2    2
4    3
3    4
1    5
dtype: int64

相關用法


注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cudf.Series.sort_values。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。