Common Dataframe Operations

FunctionsWhat it does
df.head()Gives the first n rows of the data frame. The default n value is 5.
df.tail()Gives the last n rows of the data frame. The default n value is 5
df.sample()Returns a random sample of the data frame.

Stat Functions

FunctionsWhat it does
df.sum()Returns sums of each column
df.mean()Returns means of desired axis
df.count()Counts the number of not empty values for each row, or column if you specify the axis parameter as axis='columns', and returns a Series object with the result for each row (or column).
df.std()Returns standard deviation of desired axis
df.median()Returns median of desired axis

Data Cleanup Functions

FunctionsWhat it does
df.isna()Returns a Boolean of whether there are missing values
df.fillna()Replaces null values with a desired value
df.dropna()Removes rows with null values
df.assign()Adds a new column to a data frame
df.rename()Way of changing names of rows or labels
df.drop()Removes specific row or column
df.sort_values()Sorts the data frame based on specific label

Combining Functions

FunctionsWhat it does
df.concat()Concatenates multiple dataframes along a desired axis
df.merge()Based on specified lefts and right merges two dataframes together
df.join()Inserts columns from another dataframe into an existing one

Exporting Functions

FunctionsWhat it does
df.to_csv()Converts dataframe to CSV
df.to_sql()Converts dataframe to SQL table
df.to_excel()Converts dataframe to Excel file table
df.to_json()Converts dataframe to json file