#NEWLINE# def CleanFemPreg( df ) : #NEWLINE# #INDENT# 'Recodes variables from the pregnancy frame.\n\n    df: DataFrame\n    ' #NEWLINE# df . agepreg /= 100.0 #NEWLINE# df . loc [ ( ( df . birthwgt_lb > 20 ) , 'birthwgt_lb' ) ] = np . nan #NEWLINE# na_vals = [ 97 , 98 , 99 ] #NEWLINE# df . birthwgt_lb . replace ( na_vals , np . nan , inplace = True ) #NEWLINE# df . birthwgt_oz . replace ( na_vals , np . nan , inplace = True ) #NEWLINE# df . hpagelb . replace ( na_vals , np . nan , inplace = True ) #NEWLINE# df . babysex . replace ( [ 7 , 9 ] , np . nan , inplace = True ) #NEWLINE# df . nbrnaliv . replace ( [ 9 ] , np . nan , inplace = True ) #NEWLINE# df [ 'totalwgt_lb' ] = ( df . birthwgt_lb + ( na_vals . birthwgt_oz / 16.0 ) ) #NEWLINE# df . cmintvw = np . nan