After days of fruitlessly searching the help files and the Internet for a means of converting a Dataseries of strings into numeric values in Maple I changed tack and determined how to do it myself.

I was surprised there was no built in Maple function to do this. From searching the Internet I can see I am not alone.
Since there are no other solutions on the net, here is mine:

toNumeric := (y) -> map(x->parse(x),y);

This creates the function toNumeric() that accepts a DataSeries of text values and returns it converted to a Dataseries of numeric values.

thing := DataSeries(["10", "20", "30", "55.9"], 'labels' = ["a", "b", "c", "d"]);
thing := toNumeric(thing); 

This also works on DataSeries within DataFrames !

dataframething := DataFrame([["cow", "sheep", "goat", "alpaca"], ["10", "20", "30", "55.9"]], rows = ["a", "b", "c", "d"]);
dataframething[2] := toNumeric(dataframething[2]);


If you want to see this in Maple, try:
 typecastdataseries-maple




 


Please Wait...