Note that there are some explanatory texts on larger screens.

plurals
  1. POChange an array of arrays to just an array to avoid ==> TypeError: list indices must be integers, not tuple
    text
    copied!<p>In response to the questions below, I'm offering additional clarification...</p> <p>I have an array of arrays, one column of 81 sub-arrays (81 rows). I think this equates to shape (81, 1). Each sub-array is an array with 8 elements (1 row of 8 elements). I believe this equates to shape of (1, 8). I created this array of arrays using the .append function:</p> <pre><code>row = (["str1", "str2", "str3", "str4", "str5", "str6", "str7", "str8"]) if ((row[clm_number] == best_one_value_predictor_list[1]): one_predictor_exception_array.append(row) </code></pre> <p>To access elements in the sub-array I have use the following code:</p> <pre><code>anchor_column_array = one_predictor_exception_array[:][0] </code></pre> <p>instead of</p> <pre><code>anchor_column_array = one_predictor_exception_array[:,anchor_column_index] </code></pre> <p>My goal is to create an array of shape (81, 8) so I no longer have sub-arrays. I realize that appending an array to an array creates this situation but I'd like to get to a simpler data structure. Previously, I had sucked in a csv file that was (81,8)</p> <pre><code>io.read_csv_into_array("train.C.csv") </code></pre> <p>The type of answer I'm looking for is either a) a way to append rows of data to an array without create an array of arrays (or lists) or b) a way to reshape an array of arrays to just be an simple single array. I want the final shape to be (X, Y) and i'm able to access it using [:,index]</p> <p>The first two elements in each sub-array are unique so I can just blend all the arrays. I need them to stack just like they were an (81, 8) spreadsheet. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload