Python pandas 'ffill' method not working -
in book 'python data analysis' there example using pandas' series data structure reindexing. copied simple code ipython notebook , run not change obj3
.
obj3 = series(['blue', 'purple', 'yellow'], index=[0, 2, 4]) print(obj3) obj3.reindex(range(6), method='ffill') print(obj3)
in book says output should be:
out[85]: 0 blue 1 blue 2 purple 3 purple 4 yellow 5 yellow
tried different (supposedly equivalent) method called 'pad' without success. why not working?
you need assign obj3 =
:
obj3 = obj3.reindex(range(6), method='ffill') print(obj3) 0 blue 1 blue 2 purple 3 purple 4 yellow 5 yellow dtype: object
Comments
Post a Comment