Skip to content

Commit

Permalink
Update csvTodocument.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wyl-willing authored Oct 31, 2023
1 parent 3fac02e commit 65a9be0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pre-training/chatdoctor5k/csvTodocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ def prompt_document(row):

df = pd.read_csv("disease_database_mini.csv", sep=",", encoding="utf-8")

# 遍历每一行数据

for index, row in df.iterrows():
row = row.transpose()
print(row)
# 获取文件名和文本内容

filename = str(row[0]) + ".txt"
text = ",".join([str(val) for val in row[1:]])
document_value = prompt_document(text)
Expand All @@ -95,6 +95,6 @@ def prompt_document(row):

print(document_value)

# 将文本写入文本文件

with open(os.path.join(current_path, "document", filename), "w", encoding="utf-8") as f:
f.write(document_value)
f.write(document_value)

0 comments on commit 65a9be0

Please sign in to comment.