Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DataFrame object has no attribute 'sort_values'

dataset = pd.read_csv("dataset.csv").fillna(" ")[:100]
dataset['Id']=0
dataset['i']=0
dataset['j']=0
#...
entries=dataset[dataset['Id']==0]
print type(entries)  # Prints <class 'pandas.core.frame.DataFrame'>
entries=entries.sort_values(['i','j','ColumnA','ColumnB'])

What might be the possible reason of the following error message at the last line?:

AttributeError: 'DataFrame' object has no attribute 'sort_values'
like image 342
Klausos Klausos Avatar asked Dec 28 '15 19:12

Klausos Klausos


2 Answers

Hello sort_values is new in version 0.17.0, so check your version of pandas. In the previous versions you should use sort.

entries=entries.sort(['i','j','ColumnA','ColumnB'])
like image 127
Romain Avatar answered Oct 23 '22 20:10

Romain


Check pandas version, In new versions uses sort_values in place of sort.

like image 2
Gagan Avatar answered Oct 23 '22 22:10

Gagan