import numpy as np
import pandas as pd
from pandas import Series,DataFrame
Series reindex
s1 = Series([1,2,3,4],index=["A","B","C","D"])
s1
A 1
B 2
C 3
D 4
dtype: int64
s1.reindex(index=["A","B","C","D","E"])
A 1.0
B 2.0
C 3.0
D 4.0
E NaN
dtype: float64
s1.reindex(index=["A","B","C","D","E"],fill_value=10)
A 1
B 2
C 3
D 4
E 10
dtype: int64
s2 = Series(["a","b","c"],index=[1,5,10])
s2
1 a
5 b
10 c
dtype: object