Python 3 Programming Tutorial - Reading from a CSV spreadsheet

preview_player
Показать описание
In this Python 3 programming tutorial, we cover how to read data in from a CSV spreadsheet file.

CSV, literally standing for comma separated variable, is just a file that has data that is separated by some sort of delimiter, it does not have to be a comma. Luckily for us, Python 3 has a built in module for reading and writing from and to CSV files!

Bitcoin donations: 1GV7srgR4NJx4vrk7avCmmVQQrqmv87ty6
Рекомендации по теме
Комментарии
Автор

I really like, that you don't cut our your mistakes. This way you show for what things we have to look out for. Keep up the good work.
Greetings from germany

florijanratz
Автор

Olivier Veteau You can always use an if statement, so you could iterate through the rows, like:
for row in rows:
    if 40 in row:
        print(row)

... then reference specific elements in the row like year = row[0]

sentdex
Автор

In case anyone was wondering and getting the error with whatColor.lower because the webcam feed was blocking that last little bit, you have to add a closed bracket after .lower for it to work.

coldex =

Great tutorials, sentdex! Just working my way through these tutorials in the last week has taught me a great deal!

TrueshotSonata
Автор

Hey sentdex, thank you so much for putting all this together. I learned a little bit of Python 2 a few years ago and so this series is great for getting up to speed with Python 3. The level of detail and pace of the course is perfect because once you have a general feel you can always go off and Google anything in particular. More importantly, you are teaching really practical topics such as this video. Good job and I'm really looking forward to getting into the machine learning course. You rock!

Pluvofor
Автор

Thanks for the amazing tutorials, I always come back to your content for reference. But I have one small comment : CSV stands for Comma Separated "Values", I know it's nothing major, but it still is a piece of info that we all want to make sure is delivered in a fully accurate manner.
Thanks again for the amazing content. (y)

aymanz
Автор

Your videos are what I need right now. Short and simple explanation of the basics. And some tips here and there. Thanks

kevinercia
Автор

Great little video - I appreciate your starting from the very beginning (i.e. skipping dictionaries for now). It helped me!

theJasonLee
Автор

Great job with this series so far. Really easy to understand.

everything_strength
Автор

Last time I checked, CSV = comma-separated VALUES... Aside from that, good video!

ipadguy
Автор

This tutorial was amazing and answered all of my questions. Thank you so much. You are incredible!

kylemurray
Автор

Thank you so much, I couldn't find a video describing how to do columns and rows. Youre a god.

diy-projects
Автор

This was a big help on my project. Thank you!

mikereitemeier
Автор

excellent explanation of reading and working with csv files!

whansen
Автор

Hey man, I know it's an old video but I was wondering how you turn specific elements into floats?
So i have a csv file, which has names and test results
And i want to make it into a list of tuples with [(name, float of test result), (name, float of test result)]
How would you go about doing that?

Andrew-rsgm
Автор

Thanks for this! I didn't know Python had a module that can check for delimiters. In Java I had to code delimiters by myself for a project.

badboarder
Автор

I probably wont be using CSV files a lot, but I know a lot of people will find it useful. Also, it's very interesting that Python has a 'csv' file reader built it. I thought you had to use a module called 'numPy'. Python just has everything built in!

Great tutorial!

sonickk
Автор

this is really helpful dear. thank you for sharing it. could you please let me know, how do you reader csv file with a header?

mchandresh
Автор

Thanks a lot. I will watch the series and let you know if there is any question. 

Regards

sandlermike
Автор

so I'm using the Spyder IDE and when i use code similar to this to print out the contents of the csv file into a 2d arrayList it just prints the output into the console.
Is there a way to make the data read made into a new python .py file?

michaelgarcia
Автор

I need help with calculating averages from a csv file in google stocks. should i use lists or dictionaries

wawizo