Advertisement
elena1234

extract salary in Python

Oct 13th, 2022 (edited)
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | Source Code | 0 0
  1. df_jobs['Salary from'] = df_jobs['Salary'].str.extract('([0-9]+)')
  2. df_jobs['Salary from'] = df_jobs['Salary from'].astype(float)
  3. df_jobs.head()
  4.  
  5. df_jobs['Salary to'] = df_jobs['Salary'].str.findall(r'([-+]?\d*\.\d+|\d+)').str[-1]
  6. df_jobs['Salary to'] = df_jobs['Salary to'].astype(float)
  7. df_jobs.head()
  8.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement