title: Trying to code a ANOVA One Way stats tests
body: <p>I have three columns that are as follows: column 1 : &quot;sex&quot;( data is female -or- male); column 2: &quot;children&quot; (0,1,2,3,4,5); and column 3: &quot;bmi&quot; (data floats).</p>
  <p>I need to identify only the &quot;female(s)&quot; out column 1 but column 1 contains both sex (don't need the males). Associated with the females I need to get the number of children they have as either 0, 1 or 2 from column 2 and the column 3 BMI float for that particular female.</p>
  <p>I need to create 3 new columns for results as follows:</p>
  <p>child0       child1      child2</p>
  <p>Row results are all females with columns above.</p>
  <p>But the columns above should be filled with BMI float from column 3 and placed under the 3 columns for that female</p>
  <p>Then I need to get the mean of all 3 columns and do an ANOVA -one way test with alpha=0.05 and say whether the mean BMI of women with 0, 1 or 2 children are the same or statistically different.</p>
  <p>This is my code but stuck, AX5 is a modification to AX4 which I have added other information to earlier.</p>
  <p>AX5=AX4</p>
  <p>AX4['sex']=AX4['female'] and AX3['children']=AX3['0,1,2']</p>
  <p>AX5['W_child_0','W_child_1', 'W_child_2']=pd.cut(x=AX5['sex'], bins=[0,1,2],labels=['yes 0', 'yes 1', 'yes 2'])</p>
  <p>AX5</p>
  <p>Data looks like this:</p>
  <p>age  sex        bmi        children  smoker    region           charges</p>
  <p>19   female  27.900         0        yes       southwest        16884.92400</p>
  <p>18   male    33.770         1        no        southeast        1725.55230</p>