the reader function takes file object as input to return an iterator containing the information read from the csv file the following code snippet uses the csv reader(function to read given file csv_reader csv reader(open(file_name'rb')delimiter=','once the iterator is returnedwe can easily iterate through the contents and get the data in the form/format required for the sake of completeness let' go through an example where we read the contents of the csv shown in figure - using the csv module we will then extract each of its attributes and convert the data into dict with keys representing them the following snippet forms the actions csv_rows list(csv_attr_dict dict(csv_reader none read csv csv_reader csv reader(open(file_name'rb')delimiter=delimiteriterate and extract data for row in csv_readerprint(rowcsv_rows append(rowiterate and add data to attribute lists for row in csv_rows[ :]csv_attr_dict['sno'append(row[ ]csv_attr_dict['fruit'append(row[ ]csv_attr_dict['color'append(row[ ]csv_attr_dict['price'append(row[ ]the output is dict containing each attribute as key with values and as an ordered list of values read from the csv file csv attributes:{'color'['red''yellow''yellow''orange''green''yellow''green']'fruit'['apple''banana''mango''orange''kiwi''pineapple''guava']'price'[' '' '' '' '' '' '' ']'sno'[' '' '' '' '' '' '' ']the extraction of data from csv and its transformation depends on the use case requirements the conversion of our sample csv into dict of attributes is one way we may choose different output format depending on the data and our requirements though the workflow to handle and read csv file is pretty straightforward and easy to usewe would like to standardize and speed up our process alsomore often than notit is easier to understand data in tabular format we were introduced to the pandas library in the previous with some amazing capabilities let' now utilize pandas to read csv as well the following snippet shows how pandas makes reading and extracting data from csv that' simpler and consistent as compared to the csv module df pd read_csv(file_name,sep=delimiter