Advertisement
Guest User

Pandas function

a guest
Mar 26th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  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)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement