How to create Pandas series with string in Python

1 Answer

0 votes
import pandas as pd
import numpy as np

s = pd.Series([5, 8, 0, np.nan, 9, 1, 'python', 4, 7])
 
print(s)
 
 

'''
run:
 
0         5
1         8
2         0
3       NaN
4         9
5         1
6    python
7         4
8         7
dtype: object
 
'''

 



answered Jan 2, 2021 by avibootz

Related questions

1 answer 188 views
1 answer 153 views
153 views asked Jan 1, 2021 by avibootz
2 answers 223 views
2 answers 202 views
1 answer 166 views
2 answers 200 views
200 views asked May 15, 2020 by avibootz
...