Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error : 'Series' object has no attribute 'sort' [duplicate]

I face some problem here, in my python package I have install numpy, but I still have this error:

'DataFrame' object has no attribute 'sort'

Anyone can give me some idea..

This is my code :

final.loc[-1] =['', 'P','Actual']
final.index = final.index + 1  # shifting index
final = final.sort()
final.columns=[final.columns,final.iloc[0]]
final = final.iloc[1:].reset_index(drop=True)
final.columns.names = (None, None)
like image 279
Shi Jie Tio Avatar asked Nov 18 '22 08:11

Shi Jie Tio


1 Answers

sort() was deprecated for DataFrames in favor of either:

  • sort_values() to sort by column(s)
  • sort_index() to sort by the index

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

like image 162
Brad Solomon Avatar answered Dec 10 '22 16:12

Brad Solomon