<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Getting Started with Badfish - A library for missing data
For the purposes of this tutorial, I am using R's Airquality dataset. (Attach Link). 
Let's do a quick import to get started.
Step1:  We need to convert the Pandas dataframe to Badfish's missframe.
Step2:  A MissFrame converts your data to a boolean matrix where a missing cell indicates a True value while a filled cell is given a False value.
What are the different functions that can be used with the MissFrame?
Step3:  Lets quickly use Pandas isnull().sum() function to check how many missing values are present in the different columns.
Step4:  All MissFrame methods contain the same structure of arguments.
Where - Show me data where '_____' are missing.
How - Show me data where '_____' columns are ALL/ANY missing
Columns - Show me description for only '_____' columns
We can replicate the same functionality of counting the missing values with mf.counts()
Step5:  Now let's make our query a tad more complicated.
What if I wanted to see how many data-cells of Solar,Temp and Wind are missing when Ozone is missing?
This gives an idea on how the missing data on one (or more) column affects other columns.
Step6:  Okay, so we've got 8 missing cells of Temp, 2 of Wind and Solar each when Ozone goes missing.
What happens when Ozone OR temp go missing? How does it affect the other three?
Step7:  The how = 'any' or how = 'all' controls how the columns are used.
If you want to see the number of missing cell counts in rows where Ozone AND temp go missing-
Step8:  The pattern plot below gives a nice understanding of the amount of data missing with different combinations of samples. Blue tiles indicate the presence of data whereas red tiles indicate missing data. 
We see that Ozone has the highest amount of missing data (27 samples) where-as 8 samples are missing a combination of Ozone and Temp data.
Note- The raw counts are given on the left.
Step9:  A tabular function to show which columns seem to go missing together reports these correlations of missing data-
Step10:  Or perhaps let's look at only the correlations of missing data of other columns with Ozone
Step11:  One of the well known datamining techniques is Association Rule Algorithm. Priori to the association rule generation, frequent itemsets are generated based on the item-item relations from the large data set according to a certain support. 
Thus the frequent itemsets of a data set represent strong correlations between different items, and the itemsets represent probabilities for one or more items existing together in the current transaction. If we use the different columns as items, we could find which columns go missing together and generate possibly causal association rules.
<ASSISTANT_TASK:>
Python Code:
import pandas as pd
import badfish as bf
import matplotlib.pyplot as plt
%matplotlib inline
df = pd.read_csv('data/airquality.csv', index_col=0)
Explanation: Getting Started with Badfish - A library for missing data
For the purposes of this tutorial, I am using R's Airquality dataset. (Attach Link). 
Let's do a quick import to get started.
End of explanation
mf = bf.MissFrame(df)
Explanation: We need to convert the Pandas dataframe to Badfish's missframe.
End of explanation
dir(mf)
Explanation: A MissFrame converts your data to a boolean matrix where a missing cell indicates a True value while a filled cell is given a False value.
What are the different functions that can be used with the MissFrame?
End of explanation
df.isnull().sum()
Explanation: Lets quickly use Pandas isnull().sum() function to check how many missing values are present in the different columns.
End of explanation
mf.counts()
Explanation: All MissFrame methods contain the same structure of arguments.
Where - Show me data where '_____' are missing.
How - Show me data where '_____' columns are ALL/ANY missing
Columns - Show me description for only '_____' columns
We can replicate the same functionality of counting the missing values with mf.counts()
End of explanation
mf.counts(where = ['Ozone'],how = 'any',columns=['Solar.R','Wind','Temp'])
Explanation: Now let's make our query a tad more complicated.
What if I wanted to see how many data-cells of Solar,Temp and Wind are missing when Ozone is missing?
This gives an idea on how the missing data on one (or more) column affects other columns.
End of explanation
mf.counts(where=['Ozone','Temp'], how='any', columns=['Solar.R','Wind','Temp'])
Explanation: Okay, so we've got 8 missing cells of Temp, 2 of Wind and Solar each when Ozone goes missing.
What happens when Ozone OR temp go missing? How does it affect the other three?
End of explanation
mf.counts(where = ['Ozone','Temp'],how = 'all',columns=['Solar.R','Wind','Temp'])
Explanation: The how = 'any' or how = 'all' controls how the columns are used.
If you want to see the number of missing cell counts in rows where Ozone AND temp go missing-
End of explanation
mf.plot(kind='pattern', norm = False, threshold=0.0)
mf.pattern(columns = ['Ozone', 'Temp', 'Solar.R'], norm = False, threshold=0.0)
Explanation: The pattern plot below gives a nice understanding of the amount of data missing with different combinations of samples. Blue tiles indicate the presence of data whereas red tiles indicate missing data. 
We see that Ozone has the highest amount of missing data (27 samples) where-as 8 samples are missing a combination of Ozone and Temp data.
Note- The raw counts are given on the left.
End of explanation
mf.corr(columns = ['Ozone', 'Temp','Wind'])
Explanation: A tabular function to show which columns seem to go missing together reports these correlations of missing data-
End of explanation
mf.corr()['Ozone']
Explanation: Or perhaps let's look at only the correlations of missing data of other columns with Ozone:
End of explanation
mf.frequency_item_set?
itemsets, rules = mf.frequency_item_set(columns = ['Ozone','Temp','Wind'], support=0.01, confidence=0.0)
itemsets
rules
mf.cohort(group = ['Ozone'])
Explanation: One of the well known datamining techniques is Association Rule Algorithm. Priori to the association rule generation, frequent itemsets are generated based on the item-item relations from the large data set according to a certain support. 
Thus the frequent itemsets of a data set represent strong correlations between different items, and the itemsets represent probabilities for one or more items existing together in the current transaction. If we use the different columns as items, we could find which columns go missing together and generate possibly causal association rules.
End of explanation
<END_TASK>