In the pandas Python library, we can use the Series.tolist() function to convert a pandas Series into a Python list.
import pandas
series1 = pandas.Series([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
print("Series: \n", series1)
list1 = series1.tolist()
print("List: \n", list1)
Here, we are first creating a series series1 and then, using the Series.tolist() function to convert the pandas Series into a Python list.
The output of the above program will be:
Series: 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 dtype: int64 List: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]








































0 Comments