Python | Pandas Index.insert() Last Updated : 17 Dec, 2018 Comments Improve Suggest changes Like Article Like Report Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.insert() function make new Index inserting new item at location. This function also follows Python list.append() semantics for negative values. If the negative value are passed then it start from the other end. Syntax: Index.insert(loc, item) Parameters : loc : int item : object Returns : new_index : Index Example #1: Use Index.insert() function to insert a new value in the Index. Python3 # importing pandas as pd import pandas as pd # Creating the Index idx = pd.Index(['Labrador', 'Beagle', 'Labrador', 'Lhasa', 'Husky', 'Beagle']) # Print the Index idx Output : Now insert 'Great_Dane' at the 1st index. Python3 # Inserting a value at the first position in the index. idx.insert(1, 'Great_Dane') Output : As we can see in the output, the Index.insert() function has inserted the passed value at the desired location. Example #2: Use Index.insert() function to insert a value into the Index at the second position from the last in the Index. Python3 # importing pandas as pd import pandas as pd # Creating the Index idx = pd.Index(['Labrador', 'Beagle', 'Labrador', 'Lhasa', 'Husky', 'Beagle']) # Print the Index idx Output : Now insert 'Great_Dane' at the 1st index from the last. Python3 # Inserting a value at the first position in the index. idx.insert(-1, 'Great_Dane') Output : As we can see in the output, the passed value has been inserted into the Index at the desired location. Comment More infoAdvertise with us Next Article Python | Pandas Index.insert() S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-indexing Practice Tags : python Similar Reads Python | Pandas Index.min() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.min() function returns the minimum value of the Index. The function works 2 min read Python | Pandas Index.notna() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.Pandas Index.notna() function Detect existing (non-missing) values. Return a boolean sa 2 min read Python | Pandas Index.nbytes Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.nbytes attribute return the number of bytes required to store the underlying data of the given Index object. Syntax: Index.nbytes Para 2 min read Python | Pandas Index.itemsize Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.itemsize attribute return the size of the dtype of the items of the underlying data in the given Index object. Syntax: Index.itemsize 2 min read Python | Pandas Index.ndim Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.ndim attribute return the number of dimensions of the underlying data in the given Index object. By definition it is 1. Syntax: Index. 2 min read Like