Skip to content
Advertisement

Python DataFrame Filtering and Sorting at the Same Time

Hi I have a data frame with column as following: ‘founded’ and ‘company name’

What I’m trying to do is filtering the year founded > 0 and then sorting by company name, ascending.

I’m looking for a code similar to this

JavaScript

But I got this error

JavaScript

and at the moment I have this code:

JavaScript

Are there any way that I can do the code like I intended to?

Advertisement

Answer

The error in the code is syntactical rather than a logical one.

The way you are currently doing is correct and will produce the intended result

Indentation Errors in Python are, primarily caused because there are space or tab errors in your code. Since Python uses procedural language, you may experience this error if you have not placed the tabs/spaces correctly

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement