Set Index in pandas DataFrame - PYnative
pynative.com › pandas-set-indexMar 09, 2021 · Use DataFrame.set_index () function. We need to pass the column or list of column labels as input to the DataFrame.set_index () function to set it as an index of DataFrame. By default, these new index columns are deleted from the DataFrame. df = df.set_index ( ['col_label1', 'col_label2'…]) Set the index in place.