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.
Name, Salary, Age, No.of years employed Akriti, 90000, 20, 1 Shreya, 100000, 21, 2 Priyanka, 25000, 45, 7 Neha, 46000, 25, 4
Note: For more information, refer to Working with csv files in Python
Converting CSV to HTML Table in Python
Method 1 Using pandas: One of the easiest way to convert CSV file to HTML table is using
pandas. Type the below code in the command prompt to install pandas.
pip install pandas
Example: Suppose the CSV file looks like this –
Method 2 Using PrettyTable: PrettyTable is a simple Python library designed to make it quick and easy to represent tabular data in visually appealing ASCII tables. Type the below command to install this module.
pip install PrettyTable
Example: The above CSV file is used.
- Convert HTML table into CSV file in python
- Python program to read CSV without CSV module
- Convert CSV to Excel using Pandas in Python
- Convert JSON to CSV in Python
- Create a GUI to convert CSV file into excel file using Python
- Convert CSV to JSON using Python
- Convert Excel to CSV in Python
- How to Convert an image to NumPy array and saveit to CSV file using Python?
- Convert Text File to CSV using Python Pandas
- Convert multiple JSON files to CSV Python
- How to convert an array to CSV file in PHP ?
- Convert a NumPy array into a csv file
- Python | Convert an HTML table into excel
- How to make Bootstrap table with sticky table head?
- Multiplication table till N rows where every Kth row is table of K upto Kth term
- Display the Pandas DataFrame in table style and border around the table and not around the rows
- Working with csv files in Python
- Python | Read csv using pandas.read_csv()
- Reading CSV files in Python
- Writing CSV files in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.