Using Pandas to Read CSV files

Mondli Sibanda
1 min readJan 19, 2019

CSV Files

CSV(Comma Separated Values) is a type of text file that can be used to store data separated by commas. It can be simply opened using a text editor but the data can become very confusing when there are hundreds of rows. Microsoft Excel provides a more organised approach to handling CSV files by placing them in different cells which makes it easier to read.

Pandas

Pandas is a free to use python library that provides methods to manipulate data. I have been using the Spider IDE (comes included with Anaconda — https://www.anaconda.com/ ) which comes pre — loaded with the pandas library.

In order to use the methods provided by the pandas library, simply import pandas. The method I used to import a CSV file is the “read_csv( )”. The method primarily takes the file path (specified as a string). For the full documentation on the method check: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html.

When it comes to manipulating the data set, one common method to use is the head(). This method will display the top rows and columns of the data set. This will help to get a sense of how the data set looks.

--

--

Mondli Sibanda

Virtual Assistant specializing in creating funnels and email automations. Work with me -> upwork.com/fl/mndlwth