Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
Importing Data1:29 with Craig Dennis
CSV, or Comma Separated Values, is a common way to share external datasets.
[MUSIC] 0:00 Thus far, we've created our data frames from existing Python data structures like 0:04 dictionaries, and lists of dictionaries. 0:08 However, it's more likely that the data that we have is going to come 0:10 from an external source, and typically a file of some sort. 0:14 The standard way of sharing tabular data is with what is known as CSV, 0:17 or a comma-separated value file. 0:22 If you've ever exported an spreadsheet, you've seen this as an option, 0:24 it's a standard. 0:28 The format it's pretty straightforward. 0:28 And if we convert that, basically what happens is each row gets 0:31 represented as a new line and columns are separated by commas, right? 0:36 See the values are comma separated, comma-separated values. 0:41 And there are a couple of things to be careful. 0:46 First of all, see how Guil cell has a comma already, 0:48 this would make it look like there was an extra comma. 0:51 So there are some rules to handle the edge cases. 0:54 Because this reading of CSVs is so common in the data world, there's a handy method 0:57 named read_CSV right off the base, you can parse it a relative path to a CSV file. 1:02 And just like that, boom, you get a new data frame with that data all loaded. 1:07 Pretty amazing, isn't it? 1:11 There's a couple of more parameters that you can use if your file doesn't line up 1:14 to the default standard. 1:17 Check the teacher's notes for more information of this. 1:19 Cashbox has given us a dump of their data for us to explore. 1:21 And good news, it's in standard CSV format. 1:25 Let's go take a peak. 1:28
You need to sign up for Treehouse in order to download course files.Sign up