I am trying to create a stacked barplot in seaborn with my dataframe.
I have first generated a crosstab table in pandas like so:
pd.crosstab(df[\'Pe
As you said you can use pandas to create the stacked bar plot. The argument that you want to have a "seaborn plot" is irrelevant, since every seaborn plot and every pandas plot are in the end simply matplotlib objects, as the plotting tools of both libraries are merely matplotlib wrappers.
So here is a complete solution (taking the datacreation from @andrew_reece's answer).
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
n = 500
mark = np.random.choice([True,False], n)
periods = np.random.choice(['BASELINE','WEEK 12', 'WEEK 24', 'WEEK 4'], n)
df = pd.DataFrame({'mark':mark,'period':periods})
ct = pd.crosstab(df.period, df.mark)
ct.plot.bar(stacked=True)
plt.legend(title='mark')
plt.show()