0

enter image description here

I have a webscraped data that needs to be cleaned please For values that is divided by character "-" I want to keep the value before the character "-". For values like 5000000R (4000000)R, I want to keep the first value before the ones in parentensis. And I also want to get rid of the extra characters like "IN", "R". i am using pandas dataframe

2
  • 3
    df['your_col'].str.extract(r'(\d+)'). If you have a more complex logic, make sure to provide a reproducible example and the matching expected output. Commented Sep 7, 2023 at 7:02
  • why not clean it BEFORE placing it in a file during the scraping phase Commented Sep 7, 2023 at 7:14

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.