Import data with column items given as Quantity units and use Predict?

In the column I import as xlsx or CSV I get this Quantity[1.35, “Kilograms”], I have tried flatten which works on one item but feeding in a full column does not work for me. QuantityMagnatude only works for me if I put the item directly into this function but it does not work when I put a variable in i.e. to process the whole column I am using the import Sample-Data-Animal-Weights.xlsx. This form of the import is also in Boston Home data main file. I have spent a lot of time trying to sort this. If I use Excel to extract the number I can run Predict, but because of inconsistency of decimal places this is time consuming.

Animal-Weights.nb (36.4 KB)

Sorry, here is the Data file that I am using.

Sample-Data-Animal-Weights xlsx.xlsx (10.6 KB)

Hi Declan,

The problem is that the quantities are imported as strings, see InputForm @ info. To extract the quantity magnitudes and generate the rules

data2 = Thread[Rule[QuantityMagnitude@*ToExpression /@ info, animal]]

I don’t think Predict can deal with numeric → nominal data. You will have to encode the animal names to integers.

Thank you so much for this help, also you are correct “I don’t think Predict can deal with numeric → nominal data. You will have to encode the animal names to integers.”, I have it running now.