In [1]:
%matplotlib inline
In [2]:
import numpy as np
import datetime
import pandas as pd
import matplotlib
import seaborn as sns
In [3]:
#read csv file
df = pd.read_csv('testgroups.csv', sep=";")
#show csv file column names with first lines
df.head()
Out[3]:
client_id test_group segment meil_sent
0 16 test A True
1 22 test A True
2 26 test A True
3 37 test A True
4 42 test A True
In [4]:
# bar plot
df['segment'].value_counts().plot(kind='bar')
Out[4]:
<matplotlib.axes._subplots.AxesSubplot at 0x1836848b4e0>
In [5]:
# horizontal bar plot
df['test_group'].value_counts().plot(kind='barh')
Out[5]:
<matplotlib.axes._subplots.AxesSubplot at 0x18365e75518>
In [6]:
# line plot
df['segment'].value_counts().plot(kind='line')
Out[6]:
<matplotlib.axes._subplots.AxesSubplot at 0x183688ebf60>
In [7]:
# grouped plot
newDf = pd.DataFrame({'count' : df.groupby(['test_group','segment']).size()}).reset_index()
sns.factorplot(x="segment", y='count', col="test_group", data=newDf, kind="bar")
Out[7]:
<seaborn.axisgrid.FacetGrid at 0x183689b3c18>
In [ ]: