Python Tutorial: CSV Module – How to Read, Parse, and Write CSV Files

About this tutorial:

Video duration: 16:12
In this Python Programming Tutorial, we will be learning how to work with csv files using the csv module. We will learn how to read, parse, and write to csv files. CSV stands for “Comma-Separated Values”. It is a common format for storing information. Knowing how to read, parse, and write this information to files will open the door to working with a lot of data throughout the world. Let’s get started.

The code from this video can be found at:

✅ Support My Channel Through…

Post Author:

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

24 thoughts on “Python Tutorial: CSV Module – How to Read, Parse, and Write CSV Files

    Al. V.

    (August 14, 2019 - 10:37 pm)



    (August 14, 2019 - 10:37 pm)

    Why is this so needlessly complicated?

    pd.read_csv("[file name].csv")

    What am I missing

    Gerard Donnelly

    (August 14, 2019 - 10:37 pm)

    I have a CSV file I want to modify. It is for a bill of materials each line has a part # and description PartA,description . Some lines have the same description but different part numbers "PartA,PartB,PartC",description. I want to read in these lines and if there are multiple parts give them individual lines. How do I do analysis on the information I read in ??? Any help appreciated

    VIPER Gaming Official

    (August 14, 2019 - 10:37 pm)

    how to print a particular row by giving a keyword in file

    Abdelaziz Hosny

    (August 14, 2019 - 10:37 pm)

    silly question : how did you comment your lines this way? @ 9:35


    (August 14, 2019 - 10:37 pm)

    pretty good, but ruby is easier.


    (August 14, 2019 - 10:37 pm)

    looks like corey is a blindspot fan

    Esteban Escudero

    (August 14, 2019 - 10:37 pm)

    Great video

    waterdamage restoration

    (August 14, 2019 - 10:37 pm)

    Is it possible to include any special things in the excel spreadsheet after you have crawled a website??? Lets say that you have scraped a website, and everytime the scraper find a youtube video it turns the cell into green. If there is no video in the cell it turns the cell in the spreadsheet red. Is that possible?? Thanks

    Chris LAM

    (August 14, 2019 - 10:37 pm)

    so how to actually write in the csv in python?


    (August 14, 2019 - 10:37 pm)

    please how to export sqlite to excel file


    (August 14, 2019 - 10:37 pm)

    Thank you, based python boi

    Tabish Ali

    (August 14, 2019 - 10:37 pm)


    Vinicius de jesus

    (August 14, 2019 - 10:37 pm)

    how can i made a code to read the lest line/colun of a csv file? a need make a program to read de lest line of a csv file and then use this values in the code of my python code

    Kimberly Bacchia

    (August 14, 2019 - 10:37 pm)

    SO helpful, thank you!!

    Pushpajit Biswas

    (August 14, 2019 - 10:37 pm)

    You got some real talent man, I'm really appreciate with your video.

    John Pitic

    (August 14, 2019 - 10:37 pm)

    Thank you man i will pass my gcse

    Ansh Jain

    (August 14, 2019 - 10:37 pm)

    how to print first few lines of the csv file


    (August 14, 2019 - 10:37 pm)

    Hello, I am getting an error when using csv.DictWriter. AttributeError: 'list' object has no attribute 'get'


    (August 14, 2019 - 10:37 pm)

    Corey Schafer creates more jobs than Donald Trump

    LSU Gamer

    (August 14, 2019 - 10:37 pm)

    My fieldnames has multiple fieldnames that I dont want to include. I get a value error when I dont include them in fieldnames. Do you know how to change this?

    Muhammad Hisham

    (August 14, 2019 - 10:37 pm)

    Hi, why can't i do this if there is an integer in the csv file?
    i got this error:
    Error: iterator should return strings, not int (did you open the file in text mode?)
    please help
    thank you

    Fraj Yassine Lakhal

    (August 14, 2019 - 10:37 pm)

    what's the name of the ide ?


    (August 14, 2019 - 10:37 pm)

    I have a question: if I have numbers in my CSV file and I need to take an average of 1st five numbers. Then what should we need to do? And then take that average result of five number and subtract each next number from the average value we have taken before? a bit confused can you help.

Leave a Reply

Your email address will not be published. Required fields are marked *