Electoral votes is the data frame (think of it as a table). Inside this there are columns - state and votes. This table has a default index which goes from 0 to 1. Using The above command what happens is, instead of using the default index, it starts using the values of state column as index instead. So now your new index is not 0,1,2… it is the values of the state column.
See… index is now 0,1,2… state and votes are columns…
After running the command -
0,1,2… index is gone. State column is shifted slightly if u see… it is acting as new index.