We already know that once the data structure is declared, the Index object cannot be changed.
In fact, once we have redefined the index, we are able to generate a new data structure with the existing
The Pandas Reindex () function replaces the index of a series object. It re-adjusts the elements of the original series based on the new tag sequence, creating a new Series object
The new index has no value corresponding to it, use Nan instead, delete the element without index
From the returned results we can see that all the index sequences have been adjusted
To better understand the self-made indexing function, we first define the following series objects
Its index is not complete, missing 2, 32 values. The common requirement is to insert a value to get a complete index, by Reindex () and the method option to Ffill. Additionally, you need to define the range values for the index.
The index entry for the new element, whose element is the index of the item whose index number is smaller than the previous one. So we see that the value of index 2,3 is 1, and the value of index 1
If you want to use the element following the newly inserted index, you need to use the Bfill method
The replacement index can be extended from series to dataframe, not only to replace the row index, but also to replace the column index or even replace both
Second, delete