@expect_element(invalid_data_behavior={'warn', 'raise', 'ignore'})
def winsorise_uint32(df, invalid_data_behavior, column, *columns):
 columns = list(((column,) + columns))
 mask = (df[columns] > UINT32_MAX)
 if (invalid_data_behavior != 'ignore'):
  mask |= df[columns].isnull()
 else:
  df[columns] = np.nan_to_num(df[columns])
 mv = mask.values
 if mv.any():
  if (invalid_data_behavior == 'raise'):
   raise ValueError(('%d values out of bounds for uint32: %r' % (mv.sum(), df[mask.any(axis=1)])))
  if (invalid_data_behavior == 'warn'):
   warnings.warn(('Ignoring %d values because they are out of bounds for uint32: %r' % (mv.sum(), df[mask.any(axis=1)])), stacklevel=3)
 df[mask] = 0
 return df

@ expect_element ( invalid_data_behavior = { 'warn' , 'raise' , 'ignore' } ) def winsorise_uint32 ( df , invalid_data_behavior , column , * columns ) : columns = list ( ( ( column , ) + columns ) ) mask = ( df [ columns ] > UINT32_MAX ) if ( invalid_data_behavior != 'ignore' ) : mask |= df [ columns ] . isnull ( ) else : df [ columns ] = np . nan_to_num ( df [ columns ] ) mv = mask . values if mv . any ( ) : if ( invalid_data_behavior == 'raise' ) : raise ValueError ( ( '%d values out of bounds for uint32: %r' % ( mv . sum ( ) , df [ mask . any ( axis = 1 ) ] ) ) ) if ( invalid_data_behavior == 'warn' ) : warnings . warn ( ( 'Ignoring %d values because they are out of bounds for uint32: %r' % ( mv . sum ( ) , df [ mask . any ( axis = 1 ) ] ) ) , stacklevel = 3 ) df [ mask ] = 0 return df
drops any record where a value would not fit into a uint32 .