Reputation: 1722
For a project working with Prodigy, I want to have a .jsonl file, in which each line is a json file.
To do so, I have the following code:
df['json'] = df.to_json(orient='records', lines=True).splitlines()
jsonl = ""
for js in df['json']:
jsonl += js + '\n'
How can I export this text to the following name/directory:
DIRECTORY/texts.jsonl
Upvotes: 0
Views: 93
Reputation: 115
You solved the hard part. You can write jsonl
directly to a file:
with open("DIRECTORY/texts.jsonl", "w") as f:
f.write(jsonl)
Upvotes: 1