Skip to content
Advertisement

Pandas take number out string

In my data, I have this column “price_range”.

Dummy dataset:

JavaScript

I am using pandas. What is the most efficient way to get the upper and lower bound of the price range in seperate columns?

Advertisement

Answer

Alternatively, you can parse the string accordingly (if you want to limits for each row, rather than the total range:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement