23
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'
0

2 Answers 2

28

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'])
Sign up to request clarification or add additional context in comments.

5 Comments

How can I update pandas on Windows (preferably using pip)?
@KlausosKlausos pip install -U pandas?
@Anton Protopopov: Thanks. I did pip install pandas --update. Looks like it's updating pandas.
My advice on Windows is to use the Anaconda distribution since some dependencies of pandas could be tricky to update.
"--update" didnt work for me, but "--upgrade" did: "pip install pandas --upgrade"
3

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.