Q:

Write a Pandas program to convert a Panda module Series to Python list and it’s type

0

Write a Pandas program to convert a Panda module Series to Python list and it’s type.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import pandas as pd
ds = pd.Series([2, 4, 6, 8, 10])
print("Pandas Series and type")
print(ds)
print(type(ds))
print("Convert Pandas Series to Python list")
print(ds.tolist())
print(type(ds.tolist()):
Sample Output:
Pandas Series and type                                                 
0     2                                                                
1     4                                                                
2     6                                                                
3     8                                                                
4    10                                                                
dtype: int64                                                           
<class 'pandas.core.series.Series'>                                    
Convert Pandas Series to Python list                                   
[2, 4, 6, 8, 10]                                                       
<class 'list'>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now