Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name number date
- a 1.2 123.2
- b 123.2 3/13/2019
- c 2.3 3/14/2019
- d 569 3/15/2019
- e abc 3/15/2019
- f 30 abc
- g 39.8 -3
- h 3/21/2019 3/19/2019
- i -395 3/20/2019
- j 4 3/21/2019
- name number date
- a 1.2
- b 123.2 3/13/2019
- c 2.3 3/14/2019
- d 569 3/15/2019
- e 3/15/2019
- f 30
- g 39.8
- h 3/19/2019
- i -395 3/20/2019
- j 4 3/21/2019
- df['date']=df['date'].apply(lambda x: None if str(type(x))=="<class 'str'>" else x)
- df['date']=df['date'].apply(lambda x: x.strftime('%m/%d/%Y')if not pd.isnull(x) else '')
- df['date'] = pd.to_datetime(df['date'], errors='coerce')
- df['number'] = df['number'].apply(lambda x: None if str(type(x))=="<class 'str'>" else x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement