Importing the library
Creating a DataFrame
"a", "b", and "c" are column names
0, 1, and 2 are indexes
Working with columns
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).
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
Replace df with df["Column Name"] or an equivalent variable to use these functions for a single column or set of selected values.