SHARE
TWEET

Untitled

a guest Jun 25th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. name    number      date
  2. a       1.2         123.2
  3. b       123.2       3/13/2019
  4. c       2.3         3/14/2019
  5. d       569         3/15/2019
  6. e       abc         3/15/2019
  7. f       30          abc
  8. g       39.8        -3
  9. h       3/21/2019   3/19/2019
  10. i       -395        3/20/2019
  11. j       4           3/21/2019
  12.      
  13. name    number      date
  14. a       1.2        
  15. b       123.2       3/13/2019
  16. c       2.3         3/14/2019
  17. d       569         3/15/2019
  18. e                   3/15/2019
  19. f       30          
  20. g       39.8        
  21. h                   3/19/2019
  22. i       -395        3/20/2019
  23. j       4           3/21/2019
  24.      
  25. df['date']=df['date'].apply(lambda x: None if str(type(x))=="<class 'str'>" else x)
  26.  
  27. df['date']=df['date'].apply(lambda x: x.strftime('%m/%d/%Y')if not pd.isnull(x) else '')
  28.  
  29. df['date'] = pd.to_datetime(df['date'], errors='coerce')
  30.  
  31. df['number'] = df['number'].apply(lambda x: None if str(type(x))=="<class 'str'>" else x)
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