Showing posts with label nlargest. Show all posts
Showing posts with label nlargest. Show all posts

Monday, April 17, 2017

Python Pandas Dataframe - Largest and Smallest Rows

Here is an example on how identify largest or smallest n rows.
Source Data : Census data for state of California.

Use Case : 
Read Population data for state of California from "censusdata.ire.org".
Get 3 Counties with highest population.
Get 3 Counties with lowest population.


Syntax : 


  DataFrame.nlargest()
  DataFrame.nsmallest()