The reason csv doesn't support that is because variable-length lines are not really supported on most filesystems. What you should do instead is collect all the data in lists, then call zip() on them to transpose them after.

>>> l = [('Result_1', 'Result_2', 'Result_3', 'Result_4'), (1, 2, 3, 4), (5, 6, 7, 8)]
>>> zip(*l)
[('Result_1', 1, 5), ('Result_2', 2, 6), ('Result_3', 3, 7), ('Result_4', 4, 8)]
Answer from Ignacio Vazquez-Abrams on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.to_csv.html
pandas.DataFrame.to_csv — pandas 3.0.5 documentation
If you have set a float_format then floats are converted to strings and thus csv.QUOTE_NONNUMERIC will treat them as non-numeric. ... String of length 1. Character used to quote fields. ... The newline character or character sequence to use in the output file. Defaults to os.linesep, which depends on the OS in which this method is called (’\n’ for linux, ‘\r\n’ for Windows, i.e.). ... Rows to write at a time.
Discussions

Writing a list as a column to a csv file
You can't write a column to a CSV file because they don't have columns, they have rows. So you need to think about it as adding values to the rows rather than trying to "insert" a column: with open("source.csv", 'r') as source, open("destination.csv", 'w') as destination: writer = csv.writer(destination) for row in csv.reader(source): new_row = row + function_that_returns_column_value() writer.writerow(new_row) More on reddit.com
🌐 r/learnpython
4
2
May 9, 2022
Put each values on next column of csv file
Hello All…i got the code below…I want to encode the result values into a csv file. list=[23,24,25] result = (" ".join(str(i) for i in list)) writer.writerow(["Values", result]) I want the result to be like this: Col-1 Col2 Col3 Col4 Values 23 24 25 But my code result: Col-1 Col2 Values ... More on discuss.python.org
🌐 discuss.python.org
2
0
April 6, 2023
Use Python to write on specific columns in csv file - Stack Overflow
I have data in a file and I need to write it to CSV file in specific column. The data in file is like this: 002100 002077 002147 My code is this: import csv f = open ("file.txt","r") with open(" More on stackoverflow.com
🌐 stackoverflow.com
Writing Python lists to columns in csv - Stack Overflow
I have 5 lists, all of the same length, and I'd like to write them to 5 columns in a CSV. So far, I can only write one to a column with this code: with open('test.csv', 'wb') as f: writer = csv. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Python
docs.python.org › 3 › library › csv.html
csv — CSV File Reading and Writing
The csv module’s reader and writer objects read and write sequences. Programmers can also read and write data in dictionary form using the DictReader and DictWriter classes. ... The Python Enhancement Proposal which proposed this addition to Python.
🌐
Delft Stack
delftstack.com › home › howto › python › python write list to csv column
How to Write List to CSV Columns in Python | Delft Stack
March 4, 2025 - The built-in csv module in Python is a powerful tool for handling CSV files. It provides functionality to read from and write to CSV files with ease. To write a list to CSV columns, you can utilize the csv.writer class.
🌐
Python.org
discuss.python.org › python help
Put each values on next column of csv file - Python Help - Discussions on Python.org
April 6, 2023 - Hello All…i got the code below…I want to encode the result values into a csv file. list=[23,24,25] result = (" ".join(str(i) for i in list)) writer.writerow(["Values", result]) I want the result to be like this: Col-1…
🌐
Medium
medium.com › @AlexanderObregon › how-to-read-and-write-csv-files-in-python-b84fe274d51a
How to Read and Write CSV Files in Python | Medium
October 26, 2024 - This approach is particularly useful when working with datasets that have many columns, as it makes the code more readable and helps prevent errors when accessing data. Just as reading CSV files is an important task in data processing, writing to CSV files is equally important. Writing CSV files allows you to export data in a structured format, share it between different applications, or simply store it for future analysis. Python’s csv module provides flexible tools for writing data to CSV files, whether you are working with simple lists, complex dictionaries, or require custom delimiters.
Find elsewhere
🌐
Python Morsels
pythonmorsels.com › csv-writing
Writing a CSV file - Python Morsels
February 14, 2023 - You can use Python's csv module to write to CSV files, but be careful about your line-endings
🌐
Quora
quora.com › How-do-you-write-in-a-new-column-in-CSV-with-Python-Python-CSV-development
How to write in a new column in CSV with Python (Python, CSV, development) - Quora
Answer (1 of 2): In CSV, a new column is indicated, usually by a comma. This can be another character, but usually not. Python has an inbuilt module to process CSV files, amazingly enough, called “csv" The csv.writer object takes your dataset and outputs it as a CSV formatted file. If you want...
🌐
iO Flood
ioflood.com › blog › python-write-to-csv
Python Write to CSV | Guide (With Examples)
February 1, 2024 - In this example, we write two rows of data to the CSV file. The first row is a header row with the column names, and the second row contains some actual data. And that’s it! You’ve just written data to a CSV file in Python.
🌐
Real Python
realpython.com › python-csv
Reading and Writing CSV Files in Python – Real Python
January 25, 2023 - Of course, if you can’t get your data out of pandas again, it doesn’t do you much good. Writing a DataFrame to a CSV file is just as easy as reading one in. Let’s write the data with the new column names to a new CSV file:
🌐
GeeksforGeeks
geeksforgeeks.org › python › writing-csv-files-in-python
Writing CSV files in Python - GeeksforGeeks
July 12, 2025 - Syntax: csv.writer(csvfile, dialect=’excel’, **fmtparams) ... In this example, a CSV file named "university_records.csv" is created and populated with student records. The file contains fields such as Name, Branch, Year, and CGPA. The data rows for individual students are written to the CSV file, followed by the field names.
🌐
CodeSignal
codesignal.com › learn › courses › parsing-table-data › lessons › writing-table-data-to-csv-files-using-python
Writing Table Data to CSV Files Using Python
Next, specify the file path and open the file in write mode. Use the with statement to ensure the file is properly closed after completing the operations. output_file_path = 'output.csv' with open(output_file_path, 'w', newline='') as csvfile:
🌐
Python Guides
pythonguides.com › python-write-a-list-to-csv
How to Write a List to CSV in Python - Python Guides
September 9, 2025 - Use the built-in csv.writer for quick and simple exports. Use csv.DictWriter when working with dictionaries. Use Pandas when you need advanced data handling. Use NumPy for large numerical datasets. I’ve personally used all of these methods in real-world projects, from exporting employee records to saving temperature readings. Choose the method that fits your data and workflow best, and you’ll find writing lists to CSV in Python is easier than you think.
🌐
Dive into Python
diveintopython.org › home › learn python programming › file handling and file operations › csv files handling
Read and Write Data to CSV Files with Python - Import and Export Examples
May 3, 2024 - We create a new file with the w mode and specify newline='' to avoid extra line breaks. We then use the writerow() function to write each row of data to the file. By using these code examples, you can easily provide CSV reading or loading CSV.
🌐
Python Tutorial
pythontutorial.net › home › python basics › python write csv file
How to Write to CSV Files in Python
March 30, 2025 - import csv # csv header fieldnames = ['name', 'area', 'country_code2', 'country_code3'] # csv data rows = [ {'name': 'Albania', 'area': 28748, 'country_code2': 'AL', 'country_code3': 'ALB'}, {'name': 'Algeria', 'area': 2381741, 'country_code2': 'DZ', 'country_code3': 'DZA'}, {'name': 'American Samoa', 'area': 199, 'country_code2': 'AS', 'country_code3': 'ASM'} ] with open('countries.csv', 'w', encoding='UTF8', newline='') as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() writer.writerows(rows)Code language: Python (python) How it works. First, define variables that hold the field names and data rows of the CSV file. Next, open the CSV file for writing by calling the open() function. Then, create a new instance of the DictWriter class by passing the file object (f) and fieldnames argument to it.
🌐
AskPython
askpython.com › home › creating and saving data to csv files with python
Creating and Saving Data to CSV Files with Python - AskPython
May 5, 2026 - Pass append mode "a" to write to an existing CSV without overwriting it · A CSV file stores tabular data as plain text where each value is separated by a comma. The first row typically contains column headers, and subsequent rows contain data records. Python ships with a built-in csv module ...