KOTA ITO

Generation

generate functionWed, 07 Dec 2022

160 rows × 2 columnsのデータソースから、隣接行列を生成する。

def create_adjacency_matrix(data_source): adjacency_matrix = np.zeros((160, 160), dtype=np.int) for index, row in data_source.iterrows(): adjacency_matrix[row['row_index'], row['column_index']] = 1 return adjacency_matrix create_adjacency_matrix(data_source)

Want to kickstart your project?Use the new AI Studio to create your code