MCPcopy
hub / github.com/pandas-dev/pandas / tolist

Method tolist

pandas/core/base.py:892–927  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 15

setupMethod · 0.45
setupMethod · 0.45
setupMethod · 0.45
setupMethod · 0.45
setupMethod · 0.45
setupMethod · 0.45
time_tolistMethod · 0.45
setupMethod · 0.45
setupMethod · 0.45
setupMethod · 0.45
index_with_missingFunction · 0.45

Calls

no outgoing calls

Tested by 15

index_with_missingFunction · 0.36
left_rightFunction · 0.36
test_casemethodsFunction · 0.36
test_flags_kwargFunction · 0.36
test_single_mgr_ctorMethod · 0.36
test_no_mlk_before_1986Function · 0.36
test_memorial_dayFunction · 0.36