|
import pandas as pd |
|
|
|
|
|
word_scores = pd.read_csv('word_scores2.csv') |
|
|
|
|
|
matrix2 = pd.read_csv('matrix5.csv', header=None) |
|
|
|
|
|
output_matrix = [] |
|
|
|
|
|
for index, row in word_scores.iterrows(): |
|
score = row['Score'] |
|
|
|
|
|
if score == 0: |
|
output_matrix.append([0] * 6) |
|
|
|
elif score == 1: |
|
output_matrix.append(matrix2.iloc[index % len(matrix2)].tolist()) |
|
|
|
|
|
result_output_matrix = pd.DataFrame(output_matrix, columns=['Col1', 'Col2', 'Col3', 'Col4', 'Col5', 'Col6']) |
|
|
|
|
|
result_output_matrix.to_csv('loopnum.csv', header=False, index=False) |
|
|