What is a CSV File?
- CSV (Comma-separated values) file is a plain text file.
- It is used to store large data sets.
- CSV Files store in .csv extension.
How to read CSV Files in Python using Pandas?
- Import pandas library
- Open the file folder and copy the address of the file.
- Now save it in the variable and write the name of the file after the address. In the following example “F:\Files” is address and cardata.csv is a file name.
import pandas as pd a = pd.read_csv("F:\Files\cardata.csv") a
If your data is very large then try to use the head method instead of showing all the data because it can take time.
import pandas as pd a = pd.read_csv("F:\Files\cardata.csv") a.head()
You can also read informative and interesting articles on Python and Artificial Intelligence from AI Hints.