A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/pandas-docs/stable/reference/api/../api/pandas.Series.str.repeat.html below:

pandas.Series.str.repeat — pandas 2.3.1 documentation

pandas.Series.str.repeat#
Series.str.repeat(repeats)[source]#

Duplicate each string in the Series or Index.

Parameters:
repeatsint or sequence of int

Same value for all (int) or different value per (sequence).

Returns:
Series or pandas.Index

Series or Index of repeated string objects specified by input parameter repeats.

Examples

>>> s = pd.Series(['a', 'b', 'c'])
>>> s
0    a
1    b
2    c
dtype: object

Single int repeats string in Series

>>> s.str.repeat(repeats=2)
0    aa
1    bb
2    cc
dtype: object

Sequence of int repeats corresponding string in Series

>>> s.str.repeat(repeats=[1, 2, 3])
0      a
1     bb
2    ccc
dtype: object

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4