| Importing the library
 Creating a DataFrame
 "a", "b", and "c" are column names 0, 1, and 2 are indexes Working with columns
 Example: df["avg"] = df[["a", "b", "c"]].mean(axis=1) Add a new column "avg" with the mean of the values across the specified columns. (axis=0 would find the mean across rows). | Selecting data
 You can store selected values in a variable. Ex: b_1 = df["a"].loc[df["b"] == 1] Sorting a DataFrame
 You can store a sorted DataFrame in a variable. Ex: df_sorted = df.sort_values(["a"]) Reading in and writing data
 | pandas functions
 Replace df with df["Column Name"] or an equivalent variable to use these functions for a single column or set of selected values. | 
            
                Cheatography
                https://cheatography.com
            
        
        
    
                   
                            


Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by gabriellerab