Python | Pandas MultiIndex.is_lexsorted() Last Updated : 24 Dec, 2018 Summarize Comments Improve Suggest changes Share 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 MultiIndex.is_lexsorted() function return True if the labels are lexicographically sorted. Otherwise the function return False indicating the labels are not lexicographically sorted. Syntax: MultiIndex.is_lexsorted() Parameters : None Returns : boolean Example #1: Use MultiIndex.is_lexsorted() function to check if the MultiIndex labels are lexicographically sorted or not. Python3 # importing pandas as pd import pandas as pd # Create the MultiIndex midx = pd.MultiIndex.from_arrays([['Networking', 'Cryptography', 'Anthropology', 'Science'], [88, 84, 98, 95]]) # Print the MultiIndex print(midx) Output : Now let's check if the labels in the MultiIndex are lexicographically sorted or not. Python3 # check if labels are sorted or not midx.is_lexsorted() Output : As we can see in the output, the function has returned false indicating that the labels in the MultiIndex are not lexicographically sorted. Example #2: Use MultiIndex.is_lexsorted() function to check if the MultiIndex labels are lexicographically sorted or not. Python3 # importing pandas as pd import pandas as pd # Create the MultiIndex midx = pd.MultiIndex.from_arrays([['Anthropology', 'Cryptography', 'Networking', 'Science'], [88, 84, 98, 95]]) # Print the MultiIndex print(midx) Output : Now let's check if the labels in the MultiIndex are lexicographically sorted or not. Python3 # check if labels are sorted or not midx.is_lexsorted() Output : As we can see in the output, the function has returned true indicating that the labels in the MultiIndex are lexicographically sorted. Comment More infoAdvertise with us Next Article Python | Pandas MultiIndex.to_frame() S Shubham__Ranjan Follow Improve Article Tags : Technical Scripter Python Python-pandas Python pandas-multiIndex Practice Tags : python Similar Reads Python | Pandas MultiIndex.levshape 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 MultiIndex.levshape attribute outputs a tuple containing the length of each lev 2 min read Python | Pandas MultiIndex.droplevel() 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 MultiIndex.droplevel() function return Index with requested level removed. If M 2 min read Python | Pandas MultiIndex.set_labels() 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 MultiIndex.set_labels() function set new labels on MultiIndex. Defaults to retur 2 min read Python | Pandas MultiIndex.from_arrays() 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 MultiIndex.from_arrays() function is used to convert arrays into MultiIndex. It 2 min read Python | Pandas MultiIndex.to_frame() 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 MultiIndex.to_frame() function create a DataFrame with the levels of the MultiI 2 min read Python | Pandas Index.argsort() 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.argsort() function returns the integer indices that would sort the index. 2 min read Like