In [1]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
from pandas import DataFrame, Series
In [3]:
data = DataFrame({'Sample': range(1, 11),
'Gender': ['Female', 'Male', 'Female', 'Male', 'Male',
'Male', 'Female', 'Female', 'Male', 'Female'],
'Mandedness': ['Right-handed', 'Left-handed',
'Right-handed', 'Right-handed', 'Left-handed',
'Right-handed', 'Right-handed', 'Left-handed',
'Right-handed', 'Right-handed']})
data
Out[3]:
In [9]:
data.pivot_table(index='Gender',columns='Mandedness', aggfunc='count',
margins=True)
Out[9]:
In [12]:
pd.crosstab(data.Gender, data.Mandedness, margins=True)
Out[12]:
In [13]:
pd.crosstab?
In [ ]: