SHARE
TWEET

Pandas function

a guest Mar 26th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Mejor haz una función así:
  2.  
  3. prueba = pd.DataFrame({'index':['1','2','3'],
  4.                        'col_1': [0,2,3],
  5.                        'col_2':[1,4,5]})
  6.  
  7. def clean_s(x, values, output):
  8.     if x in values:
  9.         return output
  10.     return x
  11.  
  12. prueba["col_1"] = prueba["col_1"].apply(lambda x: data_cleaner(x, [0], 777)
  13. prueba["col_2"] = prueba["col_2"].apply(lambda x: data_cleaner(x, [5], 999)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top