zach14c

Untitled

Nov 27th, 2018
297
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. # 使用項目符號進行切分
  2. def parse_info(row):
  3.           if not 'sqft' in row:
  4.                br, ba = row.split('')[:2]
  5.                sqft = np.nan
  6.           else:
  7.                br, ba, sqft = row.split('.')[:3]
  8.           return pd.Series({'Beds': br, 'Baths': ba, 'Sqft': sqft})
  9.  
  10. attr = sucln['propertyinfo_value'].apply(parse_info)
  11.  
  12. attr
Advertisement
Add Comment
Please, Sign In to add comment