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


Python pyspark Series.append用法及代碼示例

本文簡要介紹 pyspark.pandas.Series.append 的用法。

用法:

Series.append(to_append: pyspark.pandas.series.Series, ignore_index: bool = False, verify_integrity: bool = False) → pyspark.pandas.series.Series

連接兩個或多個係列。

參數

to_append係列或係列的列表/元組
ignore_index布爾值,默認為 False

如果為 True,則不要使用索引標簽。

verify_integrity布爾值,默認為 False

如果為 True,則在創建具有重複項的索引時引發異常

返回

appendedSeries

例子

>>> s1 = ps.Series([1, 2, 3])
>>> s2 = ps.Series([4, 5, 6])
>>> s3 = ps.Series([4, 5, 6], index=[3,4,5])
>>> s1.append(s2)
0    1
1    2
2    3
0    4
1    5
2    6
dtype: int64
>>> s1.append(s3)
0    1
1    2
2    3
3    4
4    5
5    6
dtype: int64

ignore_index 設置為 True:

>>> s1.append(s2, ignore_index=True)
0    1
1    2
2    3
3    4
4    5
5    6
dtype: int64

相關用法


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