1 00:00:00,005 --> 00:00:01,006 - [Instructor] One of the most common ways 2 00:00:01,006 --> 00:00:04,002 of working with spreadsheet data is with CSV, 3 00:00:04,002 --> 00:00:07,003 or comma-separated values, files. 4 00:00:07,003 --> 00:00:10,004 A CSV file is a simple file format 5 00:00:10,004 --> 00:00:12,008 for storing data in a table-like structure 6 00:00:12,008 --> 00:00:15,001 as a series of rows of values 7 00:00:15,001 --> 00:00:17,007 separated usually by commas. 8 00:00:17,007 --> 00:00:19,008 If you think about how a spreadsheet 9 00:00:19,008 --> 00:00:22,002 contains data within rows and columns, 10 00:00:22,002 --> 00:00:25,001 you can see how a CSV file represents 11 00:00:25,001 --> 00:00:28,009 the exact same data structure using plain text. 12 00:00:28,009 --> 00:00:30,006 Because of this simplicity, 13 00:00:30,006 --> 00:00:33,003 CSV files are incredibly versatile. 14 00:00:33,003 --> 00:00:35,005 They are a common way of transferring data 15 00:00:35,005 --> 00:00:36,009 between different programs, 16 00:00:36,009 --> 00:00:40,005 such as databases and spreadsheet applications. 17 00:00:40,005 --> 00:00:44,007 So let's take a look at a very simple example of a CSV file. 18 00:00:44,007 --> 00:00:47,002 In this case, we have some stock related data, 19 00:00:47,002 --> 00:00:48,007 including a ticker symbol, 20 00:00:48,007 --> 00:00:50,001 the name of the company, 21 00:00:50,001 --> 00:00:54,000 and the opening and closing price for a particular day. 22 00:00:54,000 --> 00:00:55,008 So each row represents 23 00:00:55,008 --> 00:00:59,001 a different ticker symbol and company. 24 00:00:59,001 --> 00:01:00,007 This is a plain text file, 25 00:01:00,007 --> 00:01:03,004 so you can edit it using any text editor, 26 00:01:03,004 --> 00:01:05,006 although usually you would use a program 27 00:01:05,006 --> 00:01:09,001 similar to Excel or Google Sheets or something similar. 28 00:01:09,001 --> 00:01:11,001 In the rest of this chapter, we're going to see 29 00:01:11,001 --> 00:01:14,002 how to use Python to perform basic operations 30 00:01:14,002 --> 00:01:18,004 on CSV files using the built-in CSV module 31 00:01:18,004 --> 00:01:20,000 in the standard library.