How to fill the missing value of a Series in python?

ipython

#1

I have created a series in python using pandas library in which there are some missing value.I want to know the function by which we can automatically fill the missing(NaN) values.

obj3 = Series(['blue', 'purple', 'yellow'], index=[0, 2, 4])
obj3
0      blue
2    purple
4    yellow
dtype: object

obj3.reindex(range(6))
0      blue
1       NaN
2    purple
3       NaN
4    yellow
5       NaN
dtype: object

#2

@sid100158- you can use the function bfill or ffill.

ffill- Fill (or carry) values forward.

bfill- Fill (or carry) values backward.

for example here you can use ffill .

obj3.reindex(range(6), method='ffill')
0 blue
1 blue
2 purple
3 purple
4 yellow
5 yellow

Hope this helps!

Regards,
Hinduja