Skip to content

Product Volumes Problem

Given a Series of product descriptions like “birch table measures 3’x6’x2'”, estimate the volume of each product. (Note: 3' means 3 "feet" in the imperial system of units.)

import numpy as np
import pandas as pd

descriptions = pd.Series([
    "soft and fuzzy teddy bear, product dims: 1'x2'x1', shipping not included",
    "birch table measures 3'x6'x2'",
    "tortilla blanket ~ sleep like a fajita ~ 6'x8'x1'",
    "inflatable arm tube man | 12'x1'x1' when inflated",
    "dinosaur costume -- 6'x4'x2' -- for kids and small adults"
], dtype='string')

Try with Google Colab See the solution