'dataframe' object has no attribute 'sort' - Python Error ...
www.akashmittal.com › dataframe-object-has-noMar 18, 2021 · Python throws the error, ‘dataframe’ object has no attribute ‘sort’, because Pandas deprecated sort () function in favor of sort_values () and sort_index (). As, the name indicates, sort_values () is used to sort a dataframe by value and sort_index () sorts it by index. Consider this example –. np.random.seed (0) df = pd.DataFrame ( {'A': list ('accab'), 'B': np.random.choice (10, 5)}) df A B 0 a 7 1 c 9 2 c 3 3 a 5 4 b 2.