Python | Pandas Index.intersection() 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.intersection() function form the intersection of two Index objects. This returns a new Index with elements common to the index and other, preserving the order of the calling index. Syntax: Index.intersection(other) Parameters : other : Index or array-like Returns : intersection : Index Example #1: Use Index.intersection() function to find the set intersection of two Indexes. Python3 # importing pandas as pd import pandas as pd # Creating the first Index idx1 = pd.Index(['Labrador', 'Beagle', 'Mastiff', 'Lhasa', 'Husky', 'Beagle']) # Creating the second Index idx2 = pd.Index(['Labrador', 'Great_Dane', 'Pug', 'German_sepherd', 'Husky', 'Pitbull']) # Print the first and second Index print(idx1, '\n', idx2) Output : Now we find the set intersection of the two Indexes. Python3 # Find the elements common to both the Indexes idx2.intersection(idx1) Output : As we can see in the output, the Index.intersection() function has returned the intersection of the two indexes. The ordering of the labels has been maintained based on the calling Index. Example #2: Use Index.intersection() function to find the set intersection of two Indexes. The Index contains NaN values. Python3 # importing pandas as pd import pandas as pd # Creating the first Index idx1 = pd.Index(['2015-10-31', '2015-12-02', None, '2016-01-03', '2016-02-08', '2017-05-05', '2014-02-11']) # Creating the second Index idx2 = pd.Index(['2015-10-31', '2015-10-02', '2018-01-03', '2016-02-08', '2017-06-05', '2014-07-11', None]) # Print the first and second Index print(idx1, '\n', idx2) Output : Now we find the intersection of idx1 and idx2. Python3 # find intersection and maintain # ordering of labels based on idx1 idx1.intersection(idx2) Output : Note : The missing values in both the indexes are considered common to each other. Comment More infoAdvertise with us Next Article Python | Pandas Index.intersection() S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-indexing Practice Tags : python Similar Reads Python | Pandas Index.isin() 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.isin() function return a boolean array where the index values are in valu 2 min read Python | Pandas Index.insert() 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 fun 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.isna() 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.isna() function detect missing values. It return a boolean same-sized obj 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.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.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 Python | Pandas Index.isnull() 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.isnull() function detect missing values. It return a boolean same-sized o 2 min read Python | Pandas Index.notnull() 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.notnull() function detect existing (non-missing) values. This function re 2 min read Python | Pandas Index.is_monotonic 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.is_monotonic attribute is an alias for is_monotonic_increasing. It return True if the underlying data in the given Index object is mon 2 min read Like