How to convert CSV columns to text in Python? Last Updated : 13 Jan, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we are going to see how to convert CSV columns to text in Python, and we will also see how to convert all CSV column to text. Approach: Read .CSV file using pandas dataframe.Convert particular column to list using list() constructorThen sequentially convert each element of the list to a string and join them using a specific character or space. For our program we are going to use the following CSV file: Code: Python3 # importing library import pandas as pd # Then loading csv file df = pd.read_csv('datasets/Fruit.csv') # converting ;FRUIT_NAME' column into list a = list(df['FRUIT_NAME']) # converting list into string and then joining it with space b = ' '.join(str(e) for e in a) # printing result print(b) # converting 'PRICE' column into list d = list(df['PRICE']) # another way for joining used e = '\n'.join(map(str, d)) # printing result print(e) Output: Apple Banana JackFruit Orange Pineapple Guava Grapes Mango 100 70 30 120 90 50 80 200How to convert all csv column to text ? For this, we don't need to import any library. Code: Python3 # reading csv file text = open("datasets/Fruit.csv", "r") # joining with space content of text text = ' '.join([i for i in text]) # replacing ',' by space text = text.replace(",", " ") #displaying result print(text) Output: FRUIT_NAME PRICE Apple 100 Banana 70 JackFruit 30 Orange 120 Pineapple 90 Guava 50 Grapes 80 Mango 200 Comment More infoAdvertise with us Next Article How to convert CSV columns to text in Python? P patildhanu4111999 Follow Improve Article Tags : Python python-csv Practice Tags : python Similar Reads Convert CSV to HTML Table in Python CSV file is a Comma Separated Value file that uses a comma to separate values. It is basically used for exchanging data between different applications. In this, individual rows are separated by a newline. Fields of data in each row are delimited with a comma.Example :  Name, Salary, Age, No.of year 2 min read How to Convert Pandas Columns to String Converting columns to strings allows easier manipulation when performing string operations such as pattern matching, formatting or concatenation. Pandas provides multiple ways to achieve this conversion and choosing the best method can depend on factors like the size of your dataset and the specific 3 min read Convert XML to CSV in Python XML (Extensible Markup Language) is widely used to store and transport structured data. However, for tasks like data analysis or spreadsheet editing, CSV (Comma-Separated Values) is far more user-friendly and easier to work with.To make XML data easier to process, we often convert it to a CSV file. 2 min read Convert Text File to CSV using Python Pandas Converting Text File to CSV using Python Pandas refers to the process of transforming a plain text file (often with data separated by spaces, tabs, or other delimiters) into a structured CSV (Comma Separated Values) file using the Python Pandas library.In this article we will walk you through multip 2 min read Convert Excel to CSV in Python In this article, we will be dealing with the conversion of Excel (.xlsx) file into .csv.  There are two formats mostly used in Excel : (*.xlsx) : Excel Microsoft Office Open XML Format Spreadsheet file.(*.xls) : Excel Spreadsheet (Excel 97-2003 workbook). Let's Consider a dataset of a shopping store 3 min read Convert JSON to CSV in Python We can convert JSON to CSV in Python using the built-in json and csv modules.What is JSON and CSV?JSON is a lightweight, text-based data format commonly used to exchange data between web servers and clients. It stores data in key-value pairs and is typically used for data transmission in web applica 2 min read Convert nested JSON to CSV in Python In this article, we will discuss how can we convert nested JSON to CSV in Python. An example of a simple JSON file: A simple JSON representationAs you can see in the example, a single key-value pair is separated by a colon (:) whereas each key-value pairs are separated by a comma (,). Here, "name", 9 min read Convert Column To Comma Separated List In Python A comma-separated list in Python is a sequence of values or elements separated by commas. Pandas is a Python package that offers various data structures and operations for manipulating numerical data and time series. Convert Pandas Columns to Comma Separated List Using .tolist()This article will exp 4 min read Convert TSV to TXT in Python In this article, we are going to see how to convert TSV files to text files in Python. Approach:Open TSV file using open() functionOpen txt file in which we are going to write TSV file dataThen use csv.reader() it will return a reader object which will iterate over lines in the given TSV file. (set 2 min read Like