filmov
tv
Python Basics: Reading Data From CSV File
Показать описание
Let’s create a script that is actually useful. Load of us use Spreadsheets or Excel files to store some data. What about reading the data and performing some tasks for each row from the table? Today I will show you how to generate a CSV (Comma Separated Value) file and how to read it in Python. This video will be useful for the next video, where we will actually send e-mails to all people listed in spreadsheet.
✅💻 Extra homework
The script I showed you is a simple version that does not take into account some edge cases and problems with data. Here is some list of things you might want to consider and check if you could fix them on your own:
* your script expects 5 variables in each row from CSV. What if you have more or less values? Try to create CSV without Language column and/or add one extra column, for example birthday.
* what if your data contains either “Yes”, “yes”, “Y”, “y”, “1” to indicate that someone is accepted. Can you make your script to work with many different variation of data in this column?
* what if one of the values we use: name, coach or email is empty? Can you make sure that we do not display line about the coach for accepted people if there is no coach name provided?
💁💻 My social media:
🐍📖 Check these resources to learn more:
🎬🐍 Python Basics Playlist (if you want to start from the very beginning):
✅💻 Extra homework
The script I showed you is a simple version that does not take into account some edge cases and problems with data. Here is some list of things you might want to consider and check if you could fix them on your own:
* your script expects 5 variables in each row from CSV. What if you have more or less values? Try to create CSV without Language column and/or add one extra column, for example birthday.
* what if your data contains either “Yes”, “yes”, “Y”, “y”, “1” to indicate that someone is accepted. Can you make your script to work with many different variation of data in this column?
* what if one of the values we use: name, coach or email is empty? Can you make sure that we do not display line about the coach for accepted people if there is no coach name provided?
💁💻 My social media:
🐍📖 Check these resources to learn more:
🎬🐍 Python Basics Playlist (if you want to start from the very beginning):
Комментарии