pandas.Series.to_list#

Series.to_list()[源代码]#

返回值的列表。

这些都是标量类型,即 Python 标量(针对 str、int、float)或 pandas 标量(针对 Timestamp/Timedelta/Interval/Period)。

Returns:
list

参见

numpy.ndarray.tolist

将数组返回为嵌套列表,嵌套层级深度为 a.ndim,其中包含 Python 标量。

Examples

对于 Series

>>> s = pd.Series([1, 2, 3])
>>> s.to_list()
[1, 2, 3]

对于 Index:

>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.to_list()
[1, 2, 3]