from pandas import DataFramepandas
frame = DataFrame(np.arange(9).reshape((3,3)),index=['a','c','d'],columns=['Ohio','Texas','California']io
states = ['Texas','Utah','California']import
frame.reindex(columns=states)im
# a index賦值給bco
frame.reindex(index=['a','b','c','d',method='ffill',columns=states)index
# c index賦值給b
frame.reindex(index=['a','b','c','d',method='ffill',columns=states)