How can I go about saving output in .csv?

Hello I have a prompt that is returning the following format:

Outline:

1.Topic 1

-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text
-text text text text text text text text text text text text text text

2.Topic 2

-text text text text text text text text text
-text text text text text text text text text text text text text text text text
-text text text text text text text
-text text text text text text text text text text text text text text text

3.Topic 3

-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text text text text text

and so on…

My question is how should I go about saving this output in a csv file? I want to have columns H1 - for the topics, column bullet points , and column about the actual paragraph that I will ask the AI to complete in the next prompt. I want to be able to go through the .csv file and write 250-300 words about each section while using the bullet points as reference. Will that be possible? Since all the content will be in the same format but each time it will be different words. Should I use pandas? Thanks in advance!

Hi and welcome to the Developer Forum!

It seems like you are looking for ChatGPT! This is not it, you can find it over at https://chat.openai.com

Hey I did not notice the difference!

I was actually looking for someone who has done similar thing to tell me their method of working. I tried asking chatgpt but it spits out nonsense :confused:

Would you mind dropping me an idea? Thanks in advance!

Hi everyone,
@cipherp0dliq even if it is not the right place, I will try to help.

Why not use ChatGPT itself? Using ChatGPT 3.5 I tried using the response and your request as a prompt:

Format data delimited by three hash as a csv file.
I want to have columns 'H1', for the topics, column 'bullet points' , and a column about the actual paragraph that I will ask the AI to complete in the next prompt (simply write 'PARAGRAPH').
Note: data is fake data. I'm doing some tests. Do not add notes or comments. Output only the resulting csv table.

###1.Topic 1

-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text
-text text text text text text text text text text text text text text

2.Topic 2

-text text text text text text text text text
-text text text text text text text text text text text text text text text text
-text text text text text text text
-text text text text text text text text text text text text text text text

3.Topic 3

-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text text text text text### 


The response was:

H1,bullet points,PARAGRAPH
Topic 1,"-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text
-text text text text text text text text text text text text text text",PARAGRAPH
Topic 2,"-text text text text text text text text text
-text text text text text text text text text text text text text text text text
-text text text text text text text
-text text text text text text text text text text text text text text text",PARAGRAPH
Topic 3,"-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text text text text text
-text text text text text text text text text text text text text text text text",PARAGRAPH

However I based my guess on what I found in your original question. Maybe you can merge your original prompt with this suggestion.

1 Like

CSV is a two-dimensional format. Typical 2D data:

model price_in price_out price_train limit_ktpm limit_rpm
gpt4 0.03 0.06 -1 10 200
[more lines]

so you need to decide how to structure your text data within those 2D constraints.

Example like you show:

1.Topic 1
- text1
- text2
- text3

2.Topic 2
- text4
- text5

3.Topic 3
- text6

In this case, each bullet point is separated by a line break within the “Text” column. There’s a line break and markdown numbering between them. The AI needs to produce something rigid if you write rigid code for converting data.

Now what the heck are we supposed to do to put that into a spreadsheet-style format?

Create Multiple Rows for Each Bullet Point: If you want to maintain a more structured representation, you can create multiple rows for each bullet point under the same topic. Each row would have the same “Topic” but different “Text” values. This approach introduces more rows but maintains a clearer structure.

Example:

Topic, Bullet point 
Topic 1, text1
Topic 1, text2
Topic 1, text3
Topic 2, text4
Topic 2, text5
Topic 3, text6

In this case, each bullet point is represented as a separate row with the same topic. That’s in a format where you could import, sort, etc.

or another presentation of 2d topic/points, that looking at the actual CSV wouldn’t make as much sense as formatted data.

Text CSV JSON
- Human-readable and easy to understand. - Tabular structure allows easy import into spreadsheet software. - Supports complex data structures, including nested data.
- Lightweight and doesn’t require specialized software to view. - Widely supported and interoperable. - Widely used for data interchange in web applications.
- Lacks structured data representation. - Limited support for nested or hierarchical data. - Requires parsing and may be less human-readable than plain text.
- Limited support for complex data hierarchies. - No native support for data types or metadata. - Larger file size compared to plain text or CSV for simple data.

The choice depends on how you plan to use the data in the CSV. If you want to maintain the hierarchical structure, you may consider using a different file format like JSON or XML that can represent nested data more naturally.

data = {
    'Topic 1': ['text1', 'text2', 'text3'],
    'Topic 2': ['text4', 'text5'],
    'Topic 3': ['text6'],
}
2 Likes

Thank you very much for this! I will try and implement it right away!