Return a list of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period) Returns ------- list List containing the values as Python or p
(self)
| 890 | return result # type: ignore[return-value] |
| 891 | |
| 892 | def tolist(self) -> list: |
| 893 | """ |
| 894 | Return a list of the values. |
| 895 | |
| 896 | These are each a scalar type, which is a Python scalar |
| 897 | (for str, int, float) or a pandas scalar |
| 898 | (for Timestamp/Timedelta/Interval/Period) |
| 899 | |
| 900 | Returns |
| 901 | ------- |
| 902 | list |
| 903 | List containing the values as Python or pandas scalers. |
| 904 | |
| 905 | See Also |
| 906 | -------- |
| 907 | numpy.ndarray.tolist : Return the array as an a.ndim-levels deep |
| 908 | nested list of Python scalars. |
| 909 | |
| 910 | Examples |
| 911 | -------- |
| 912 | For Series |
| 913 | |
| 914 | >>> s = pd.Series([1, 2, 3]) |
| 915 | >>> s.to_list() |
| 916 | [1, 2, 3] |
| 917 | |
| 918 | For Index: |
| 919 | |
| 920 | >>> idx = pd.Index([1, 2, 3]) |
| 921 | >>> idx |
| 922 | Index([1, 2, 3], dtype='int64') |
| 923 | |
| 924 | >>> idx.to_list() |
| 925 | [1, 2, 3] |
| 926 | """ |
| 927 | return self._values.tolist() |
| 928 | |
| 929 | to_list = tolist |
| 930 |
no outgoing calls