Problem: My data consists of Real values at Real $x, y$ positions. It is stored in the array-forms: comma-separated (type .csv) and spreadsheet (type .xlsx). As a Mathematica Dataset, it may be referred to as a "a table with named columns and named rows" and "association of associations". I use Windows 10; MacBook when on the road.
Questions: Using a (row,col) array sequence, e.g., if the $x,y$-positions run across, down, respectively, how do I: a) Import this data so that each value(x,y) is associated with $x, y$, for example: Value(2,3) is at position x(3), y(2)? I prefer doing this in two steps: Import then convert. Note: Import of .csv formatted data only accessed the first row whereas import of .xlsx accessed the entire file (see below). b) Use Fit, FindFit and List- or FunctionInterpolation to obtain values to replace those missing in my data? Also, how to denote values as missing (I cannot use zero)? c) Plot the resulting data in 3-D and as contours?
Attempts to solve the problem using the sample data set:
0, 1, 2, 3, 4
1, 11,12,13,14
2, 21,22,23,24
3, 31,32,33,34
4, 41,42,43,44
(the actual set is real and much larger), stored as shown and as an Excel .xlsx file follow.
Attempt 1. Import the data with
Import["C:\\Users\\njs\\Documents\\Computing\\Software\\Mathematica\\
sampleData3.xlsx"]
The result is an apparently correct list of lists, but TableForm displays the data transposed which I don't understand. Aside: When typing a comment below this transposed result, values in the table were appended with super fix 'grave' symbols. Why? What do they mean?
Attempt 2. Import and flatten it using a Data statement:
myData = Flatten[
MapIndexed[{Sequence @@ #2, #1} &,
Import["/Users/nick/Documents/Mathematica/sampleData3.xlsx",
{"Data", 1, {2, 3, 4, 5}, {2, 3, 4, 5}}
], (* <-- close Import. NOTE: {"Data", 1, {2;;5},{2;;5} did not work *)
{2}], (* <-- Close MapIndexed *)
1] (* <-- Close Flatten *)
This gives a good result, but I cannot explicitly list all the rows and columns in the much larger actual data set. How to list to end of rows, columns?
Some queer results: In a .nb file, when typing a comment below the Imported output, a red square (akin to a bullet) appeared at the head of the comment. What does the red square (bullet) mean? How did it occur? How to be rid of it? The 'grave' symbols were mentioned above.
Key References:
Import Excel sheet into 3D array? <-- Use Flatten w/ Sequence to get (x,y,f) values
https://reference.wolfram.com/language/howto/ImportASpreadsheet.html <-- Import part of a spreadsheet using the Data statement
Other References:
https://reference.wolfram.com/language/ref/ListInterpolation.html
https://reference.wolfram.com/language/ref/Dataset.html <-- > Details => 3D plot
https://reference.wolfram.com/language/ref/FunctionInterpolation.html <-- 1D only