You can specify a python write mode in the pandas to_csv function. For append it is 'a'.

In your case:

df.to_csv('my_csv.csv', mode='a', header=False)

The default mode is 'w'.

If the file initially might be missing, you can make sure the header is printed at the first write using this variation:

output_path='my_csv.csv'
df.to_csv(output_path, mode='a', header=not os.path.exists(output_path))
Answer from tlingf on Stack Overflow
🌐
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.to_csv.html
pandas.DataFrame.to_csv — pandas 3.0.3 documentation
String, path object (implementing os.PathLike[str]), or file-like object implementing a write() function. If None, the result is returned as a string. If a non-binary file object is passed, it should be opened with newline=’’, disabling universal newlines. If a binary file object is passed, mode might need to contain a ‘b’.
🌐
Net Informations
net-informations.com › ds › pd › tocsv.htm
How to Export Pandas DataFrame to a CSV File
To append a DataFrame's content to an already existing CSV file, you can use the mode argument in the to_csv() method and set it to 'a' for append mode.
🌐
GitHub
github.com › pandas-dev › pandas › issues › 19827
File mode in `to_csv` is ignored, when passing a file object instead of a path · Issue #19827 · pandas-dev/pandas
February 21, 2018 - Code Sample, a copy-pastable example if possible >>> import pandas as pd >>> df = pd.read_csv("example.csv") >>> df.head() just a file 0 1 2 3 1 4 5 6 2 7 8 9 >>> with open("someother.csv", "wb") as f: ... df.to_csv(f, mode="wb") ... Tra...
Author   pandas-dev
🌐
GitHub
github.com › dask › dask › issues › 9088
to_csv save mode default & options · Issue #9088 · dask/dask
May 14, 2022 - pandas has different to_csv write modes like w+, w, and a.
Author   dask
🌐
Statology
statology.org › home › pandas: how to append data to existing csv file
Pandas: How to Append Data to Existing CSV File
July 16, 2021 - Here’s how to interpret the arguments in the to_csv() function: ‘existing.csv’: The name of the existing CSV file. mode=’a’: Use the ‘append’ mode as opposed to ‘w’ – the default ‘write’ mode.
🌐
GitHub
github.com › rapidsai › cudf › issues › 10121
[FEA] Support "mode" argument to to_csv · Issue #10121 · rapidsai/cudf
January 25, 2022 - PythonAffects Python cuDF API.Affects Python cuDF API.cuIOcuIO issuecuIO issuefeature requestNew feature or requestNew feature or requestlibcudfAffects libcudf (C++/CUDA) code.Affects libcudf (C++/CUDA) code. ... import cudf df = cudf.DataFrame({'id': [0, 1, 2]}) df.to_csv('test.csv', header=False, index=False, mode='a')
Author   rapidsai
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-append-pandas-dataframe-to-existing-csv-file
How to Append Pandas DataFrame to Existing CSV File? - GeeksforGeeks
July 23, 2025 - Add Pandas DataFrame to an Existing CSV File. To achieve this, we can utilize the to_csv() function in Pandas with the 'a' parameter to write the DataFrame to the CSV file in append mode.
🌐
Medium
medium.com › @amit25173 › how-to-use-to-csv-step-by-step-guide-94e1f9d81be1
How to Use to_csv() — Step-by-Step Guide | by Amit Yadav | Medium
March 6, 2025 - You might be wondering: “What if I have more than one DataFrame to save in the same file?” The trick here is to use mode='a' to append data and header=False after the first export (to avoid repeating headers).
Find elsewhere
🌐
Dask
docs.dask.org › en › stable › generated › dask.dataframe.to_csv.html
dask.dataframe.to_csv — Dask documentation
A string representing the encoding ... or overwriting an existing file in text mode. ‘a’ (or ‘at’) will append to an existing file in text mode or create a new file if it does not already exist....
🌐
Readthedocs
datatable.readthedocs.io › en › latest › api › frame › to_csv.html
.to_csv() – datatable.Frame. — datatable documentation
To use csv.QUOTE_* constants, csv module must be imported first. ... If True, the file given in the path parameter will be opened for appending (i.e. mode=”a”), or created if it doesn’t exist.
🌐
Programiz
programiz.com › python-programming › pandas › methods › to_csv
Pandas to_csv() (With Examples)
Here, since we are using header=False ... 2,John,19,Paris 3,Tom,18,Berlin · In Pandas, the mode parameter in the to_csv() method is used to specify the mode in which the file is opened....
🌐
w3resource
w3resource.com › pandas › dataframe › dataframe-to_csv.php
Pandas DataFrame: to_csv() function - w3resource
August 19, 2022 - The to_csv() function is used to write object to a comma-separated values (csv) file. Syntax: DataFrame.to_csv(self, path_or_buf=None, sep=', ', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, mode='w', ...
🌐
Apache
spark.apache.org › docs › latest › api › python › reference › pyspark.pandas › api › pyspark.pandas.DataFrame.to_csv.html
pyspark.pandas.DataFrame.to_csv — PySpark 4.1.2 documentation
mode can accept the strings for Spark writing mode. Such as ‘append’, ‘overwrite’, ‘ignore’, ‘error’, ‘errorifexists’. ‘append’ (equivalent to ‘a’): Append the new data to existing data.
🌐
Medium
medium.com › @robblatt › use-python-and-pandas-to-append-to-a-csv-503bf22670ce
Use Python and Pandas to Append to a CSV | by Rob Blatt | Medium
September 9, 2019 - # header = False will prevent the headers from being written to your file, which would come along with a Nan value for the row.# ----------------------------------------------------------------- # IF YOU CAME HERE VIA SEARCH, THIS IS THE CODE YOU ARE LOOKING FOR # -----------------------------------------------------------------df2.to_csv('test.csv', mode = 'a', header = False)# You're still reading?
🌐
Mode
mode.com › blog › python-csv-exports
Improved Python Notebooks Make Sharing Analysis Easier than Ever | Mode
Now you can export your work as a CSV to share with your sales team by clicking Export at the top of your notebook, or simply downloading it right from the output cell.
🌐
Python
docs.python.org › 3 › library › csv.html
csv — CSV File Reading and Writing
Still, while the delimiters and quoting characters vary, the overall format is similar enough that it is possible to write a single module which can efficiently manipulate such data, hiding the details of reading and writing the data from the programmer. The csv module implements classes to read and write tabular data in CSV format.
🌐
Note.nkmk.me
note.nkmk.me › home › python › pandas
pandas: Write DataFrame to CSV with to_csv() | note.nkmk.me
August 4, 2023 - The default delimiter is a comma ,, which produces a CSV file. To create a TSV file, which uses a tab character \t as the delimiter, you can simply set sep='\t'. ... The mode argument allows you to specify the write mode, similar to the built-in open() function.
🌐
Python.org
discuss.python.org › python help
Df.to_csv append new values but why at csv file the value become scientific - Python Help - Discussions on Python.org
June 28, 2023 - Hello Good Day to All…I have script to append values to existing csv file. When checking the time stamp values become scientific. I have tried several format but it does not change. I want to display number with no scientific formay…Please help on this…thanks Here is my code xc_df = pd.DataFrame(xc_log_ls, columns=["Lot", "Wafer", "TestMode", "TimeStamp", "TestProg", "Tester", "DateTimeLog", "XYCoor", "Result"]) if os.path.isfile("xclog.csv"): xc_df.to_csv("xc...