import pandas as pd

"""
Explanation: Title: Sorting Rows In pandas Dataframes
Slug: pandas_sorting_rows_dataframe
Summary: Sorting Rows In pandas Dataframes
Date: 2016-05-01 12:00
Category: Python
Tags: Data Wrangling
Authors: Chris Albon  
import modules
End of explanation
"""


data = {'name': ['Jason', 'Molly', 'Tina', 'Jake', 'Amy'], 
        'year': [2012, 2012, 2013, 2014, 2014], 
        'reports': [1, 2, 1, 2, 3],
        'coverage': [2, 2, 3, 3, 3]}
df = pd.DataFrame(data, index = ['Cochice', 'Pima', 'Santa Cruz', 'Maricopa', 'Yuma'])
df

"""
Explanation: Create dataframe
End of explanation
"""


df.sort_values(by='reports', ascending=0)

"""
Explanation: Sort the dataframe's rows by reports, in descending order
End of explanation
"""


df.sort_values(by=['coverage', 'reports'])

"""
Explanation: Sort the dataframe's rows by coverage and then by reports, in ascending order
End of explanation
"""


