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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -