0

I’m completely new to python so I don’t have a clue where to start but I have an excel spreadsheet table with 10,000 pieces of data about the google App Store. I’ve imported panda and imported the csv into python aswell. There are 5 columns including name, genre, rating, price, downloads. I need to sort the data frame from highest price first and descending down. Anyone have any simple solutions?

1

2 Answers 2

1

Try this -

import pandas as pd
df = pd.read_csv('google-play-store.csv')
df.sort_values(by=['price'], ascending=False)
Sign up to request clarification or add additional context in comments.

1 Comment

you need to use either inplace=True or store returned df into a variable.
1

Python has a very good API documentation for pandas. You can explore the sort_values method for a DataFrame here.

Note, by default it places NA values at the last, sorts in ascending order and inplace = False (that is return a new df). For your problem, you can use

import pandas as pd
df = pd.read_csv('your_filename.csv')
df.sort_values(by='price', ascending=False, inplace=True)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.