Explore Courses Blog Tutorials Interview Questions
0 votes
in Data Science by (50.2k points)

I face some problem here, in my python package I have to install numpy, but I still have this error 'DataFrame' object has no attribute 'sort'

Anyone can give me some ideas...

This is my code :

final.loc[-1] =['', 'P','Actual']

final.index = final.index + 1  # shifting index

final = final.sort()


final = final.iloc[1:].reset_index(drop=True)

final.columns.names = (None, None)

1 Answer

0 votes
by (108k points)


sort() was deprecated for DataFrames in favor of either this: sort_values() to sort by column(s) or this: sort_index() to sort by the index.

sort() was deprecated but still available in Pandas with release 0.17 with the introduction of sort_values() and sort_index(). It was removed from Pandas with release 0.20 (2017-05-05).


Browse Categories