Spec-Zone.ru › pandas 0.20

pandas.Series.append

Series.append(to_append, ignore_index=False, verify_integrity=False) [source]

Объединить две или более Series.

Параметры:

to_append : Series или список/кортеж Series

ignore_index : boolean, по умолчанию False

Если True, не использовать метки индекса.

verify_integrity : boolean, по умолчанию False

Если True, генерировать исключение при создании индекса с дубликатами

Возвращает:

appended : Series

Примеры

>>> s1 = pd.Series([1, 2, 3])
>>> s2 = pd.Series([4, 5, 6])
>>> s3 = pd.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

При значении verify_integrity равном True:

>>> s1.append(s2, verify_integrity=True)
Traceback (most recent call last):
...
ValueError: Indexes have overlapping values: [0, 1, 2]

© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.20.3/generated/pandas.Series.append.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API