csv ファイルを取得し、このデータを Python の多次元配列にインポートする必要がありますが、データを空の配列に追加した後、配列から「なし」の値を削除する方法がわかりません。
最初に次のような構造を作成しました。
storecoeffs = numpy.empty((5,11), dtype='object')
これは、「なし」が入力された 5 行 x 11 列の配列を返します。
次に、csv ファイルを開き、配列に変換しました。
coeffsarray = list(csv.reader(open("file.csv")))
coeffsarray = numpy.array(coeffsarray, dtype='object')
次に、2 つの配列を追加しました。
newmatrix = numpy.append(storecoeffs, coeffsarray, axis=1)
結果は、「なし」の値とその後に必要なデータが入力された配列です (最初の 2 行は、データの性質に関するアイデアを提供するために示されています)。
array([[None, None, None, None, None, None, None, None, None, None, None,
workers, constant, hhsize, inc1, inc2, inc3, inc4, age1, age2,
age3, age4],[None, None, None, None, None, None, None, None, None, None, None,
w0, 7.334, -1.406, 2.823, 2.025, 0.5145, 0, -4.936, -5.054, -2.8, 0],,...]], dtype=object)
これらの「なし」オブジェクトを各行から削除するにはどうすればよいので、残っているのはデータを含む 5 x11 多次元配列ですか?