Duplicate each string in the Series or Index. Duplicates each string in the Series or Index, either by applying the same repeat count to all elements or by using different repeat values for each element. Parameters ---------- repeats : int o
(self, repeats)
| 1820 | |
| 1821 | @forbid_nonstring_types(["bytes"]) |
| 1822 | def repeat(self, repeats): |
| 1823 | """ |
| 1824 | Duplicate each string in the Series or Index. |
| 1825 | |
| 1826 | Duplicates each string in the Series or Index, either by applying the |
| 1827 | same repeat count to all elements or by using different repeat values |
| 1828 | for each element. |
| 1829 | |
| 1830 | Parameters |
| 1831 | ---------- |
| 1832 | repeats : int or sequence of int |
| 1833 | Same value for all (int) or different value per (sequence). |
| 1834 | |
| 1835 | Returns |
| 1836 | ------- |
| 1837 | Series or pandas.Index |
| 1838 | Series or Index of repeated string objects specified by |
| 1839 | input parameter repeats. |
| 1840 | |
| 1841 | See Also |
| 1842 | -------- |
| 1843 | Series.str.lower : Convert all characters in each string to lowercase. |
| 1844 | Series.str.upper : Convert all characters in each string to uppercase. |
| 1845 | Series.str.title : Convert each string to title case (capitalizing the first |
| 1846 | letter of each word). |
| 1847 | Series.str.strip : Remove leading and trailing whitespace from each string. |
| 1848 | Series.str.replace : Replace occurrences of a substring with another substring |
| 1849 | in each string. |
| 1850 | Series.str.ljust : Left-justify each string in the Series/Index by padding with |
| 1851 | a specified character. |
| 1852 | Series.str.rjust : Right-justify each string in the Series/Index by padding with |
| 1853 | a specified character. |
| 1854 | |
| 1855 | Examples |
| 1856 | -------- |
| 1857 | >>> s = pd.Series(["a", "b", "c"]) |
| 1858 | >>> s |
| 1859 | 0 a |
| 1860 | 1 b |
| 1861 | 2 c |
| 1862 | dtype: str |
| 1863 | |
| 1864 | Single int repeats string in Series |
| 1865 | |
| 1866 | >>> s.str.repeat(repeats=2) |
| 1867 | 0 aa |
| 1868 | 1 bb |
| 1869 | 2 cc |
| 1870 | dtype: str |
| 1871 | |
| 1872 | Sequence of int repeats corresponding string in Series |
| 1873 | |
| 1874 | >>> s.str.repeat(repeats=[1, 2, 3]) |
| 1875 | 0 a |
| 1876 | 1 bb |
| 1877 | 2 ccc |
| 1878 | dtype: str |
| 1879 | """ |
nothing calls this directly
no test coverage detected