How to write Pandas DataFrame as TSV using Python? Last Updated : 05 Nov, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss how to write pandas dataframe as TSV using Python. Let's start by creating a data frame. It can be done by importing an existing file, but for simplicity, we will create our own. Python3 # importing the module import pandas as pd # creating some sample data sample = {'name': ['a', 'b', 'c', 'd'], 'age': [24, 65, 39, 18]} # creating the DataFrame df = pd.DataFrame(sample) # displaying the DataFrame print(df) Output: name age 0 a 24 1 b 65 2 c 39 3 d 18 Now, let's export this as a TSV file. We can use to_csv method from pandas for this. Syntax: df.to_csv(" file.tsv", sep = "") Example: Python3 # saving as tsv file df.to_csv('example.tsv', sep="\t") Output: Here, sep defines what is the separator which separates the data entries in the file. In this case, we define it as a tabspace ('\t'). It will create a .csv file by default if the separator is not defined. Comment More infoAdvertise with us Next Article How to write Pandas DataFrame as TSV using Python? J jayanth1archer Follow Improve Article Tags : Python Python-pandas Python pandas-io Practice Tags : python Similar Reads Pandas DataFrame.to_string-Python Pandas is a powerful Python library for data manipulation, with DataFrame as its key two-dimensional, labeled data structure. It allows easy formatting and readable display of data. DataFrame.to_string() function in Pandas is specifically designed to render a DataFrame into a console-friendly tabula 5 min read How to write Pandas DataFrame to PostgreSQL table? In this article, we will be looking at some methods to write Pandas dataframes to PostgreSQL tables in the Python. Method 1: Using to_sql() function to_sql function is used to write the given dataframe to a SQL database. Syntax df.to_sql('data', con=conn, if_exists='replace', index=False) Parameter 3 min read Pandas - DataFrame to CSV file using tab separator Let's see how to convert a DataFrame to a CSV file using the tab separator. We will be using the to_csv() method to save a DataFrame as a csv file. To save the DataFrame with tab separators, we have to pass "\t" as the sep parameter in the to_csv() method. Approach : Import the Pandas and Numpy mod 1 min read Python | Pandas DataFrame.to_records Pandas DataFrame is a two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. It can be thought of as a dict-like container for Series objects. This is the primary data structure o 2 min read Python | Pandas DataFrame.to_html() method With help of DataFrame.to_html() method, we can get the html format of a dataframe by using DataFrame.to_html() method. Syntax : DataFrame.to_html() Return : Return the html format of a dataframe. Example #1 : In this example we can say that by using DataFrame.to_html() method, we are able to get th 1 min read Like