# Important Methods in DataFrame

## Methods

1. value\_counts()
    
    * Works for series and data frame
        
    
    * Gives the frequency for every unique item in series
        
    * Most useful is when it is applied to series
        
    * No data frame counts the frequency of unique rows when applied to an entire data frame
        
2. sort\_values()
    
    * Applicable to both series as well as data frames
        
    * series.sort\_values() by default is ascending
        
    * sort\_values() when applied missing values it will put them at last by default
        
    * We can change this behavior by changing the parameter passed to the top or last
        
    * By default, the sorting will happen and the changes are not stored
        
    * However, we can store by using in place
        
        ```python
        df.sort_values(['Courses', 'Discount'],
                      ascending = [True, True])
        ```
        
3. sort\_index()
    
    * Perform sorting based on index
        
    * applicable in both series and data frame
        
4. rank()
    
    * applicable only on series
        
    * will give rank based on lower values as rank one to higher values
        
5. set\_index()
    
    * We can change the default index to any column using this
        
    * Applicable to data frames only
        
6. sort\_index()
    
    * Applicable on both series and data frames
        
    * Sorts based on an index
        
7. reset\_index()
    
    * Applicable on both series and data frame when applied on series it will convert it into a data frame
        
    * We can reset\_index() in the data frame
        
    * how to replace existing index without loosing
        
        ```python
        batsman.reset_index().set_index('batting_rank')
        ```
        
8. rename()
    
    * applicable only on a data frame
        
    * pass in a dictionary with the key as the original value and the value as the value we want to change
        
9. unique()
    
    * gives the unique values in the series
        
    * applicable only on series
        
    * counts missing values as well
        
10. unique()
    
    * does not count missing values
        
11. IsNull()
    
    * applicable on series and data frame
        
    * checks whether the value is missing value or not in series (replace missing values with true and not missing values with false)
        
12. notnull()
    
    * exact opposite of isnull()
        
13. hasn't()
    
    * returns true if we have missing values or not
        
    * applicable only on series
        
14. dropna
    
    * this will remove all the rows where all columns have null values
        
    * when we pass in a subset then it will remove the rows where the specified subset has null.here we are looking for those values which can be null is any of the columns mentioned
        
    * applicable in series and dataframe both
        
    * how parameter -&gt; works like or
        
15. fillna
    
    * Fill NA/NaN values using the specified method.
        
    * applicable on series and pandas
        
16. apply
    
    * Fill NA/NaN values using the specified method
