Extract Numeric Values From Character Data

Take a look at ‘Valuation ($B)’ column below. It is registered as character type even though it looks like a numeric data.

Due to the currency symbol inside the text data, the system has recognized it as Character data type when importing the data.

Often, we want to convert this type of data to the numeric data type so that we can treat it as numbers and perform numeric calculations with it.

You can select ‘Convert to Numeric’ from the column header menu.

This will create a ‘mutate’ dialog with the following expression.

extract_numeric(`Valuation ($B)`)

Once you click ‘Run’ button, ‘Valuation ($B)’ column is now converted to numeric data type and it now shows a histogram with numeric statistics.

Sample Data - Unicorn Data

I have used the Unicorn (startups whose valuations are greater than $1 billions.) data from CB Insights web site.

You can copy and paste the URL and hit ‘Get Data’ button to scrape the table data from the web page.

Here is how it looks once the data is imported.