You can use this below code to achieve your desired output.
df = census_df.groupby(["STNAME"]).apply(lambda x: x.sort_values(["CENSUS2010POP"], ascending = False)).reset_index(drop=True)
df.groupby('STNAME').head(3)[['STNAME','CENSUS2010POP']]
In the above code, the first line gives the sorted CENSUS2010POP of each STNAME.
the second line gives the top 3 records
If you want to know more about the Data Science then do check out the following Data Science which will help you in understanding Data Science from scratch