# Perform calculations with the $symbol within the elements a dataset? Posted 2 years ago 3450 Views | 2 Replies | 1 Total Likes |  Hello Wolfram Mathematica community,I've been playing around with Mathematica and I've isolated a set of data on a website; however, there are money signs within the data set. Is it possible to still perform mathematical processes with the$ symbol within the elements in the set? I tried and it thought the money sign was a variable. Attachments:
2 Replies
Sort By:
Posted 2 years ago
 William,The problem is that the data is imported as strings. Part[data2, 2, 2, 2, 2, 1] // InputForm (* {"--", "Max Scherzer", "WSH", "SP", "$42,142,857", "7 (2015-21)", "$210,000,000", "$30,000,000"} *) To convert to numbers, remove the $ and , and then ToExpression data = Part[data2, 2, 2, 2, 2, All, 7] // StringReplace[{"\$" -> "", "," -> ""}] // Map[ToExpression]; Compute mean N@Mean[data] 
 Or use a currency interpreter: data=Import["https://www.usatoday.com/sports/mlb/salaries/",{"Data"}]; salaryStrings=data[[2,2,2,2,All,5]]; salaries=Interpreter["CurrencyAmount"]@salaryStrings//Cases[#,_Quantity]&; Mean@salaries//N