When working with data frames, most of the time you will load in data from an existing data set. One of the most common formats for big datasets is the CSV.
CSV (comma separated values) is a text-only spreadsheet format. You can find CSVs in lots of places such as:
- online datasets from governments and companies (here’s an example from data.gov)
- exported from Excel or Google Sheets
- exported from SQL
The first row of a CSV contains column headings. All subsequent rows contain values. Each column heading and each variable is separated by a comma:
column1,column2,column3 value1,value2,value3 value4,value5,value6
That example CSV represents the following table:
You run a cupcake store and want to create a record of all of the cupcakes that you offer.
Write the following data as a CSV in
|Red Velvet Cake||chocolate||cream cheese||strawberries|
|Birthday Cake||vanilla||vanilla||rainbow sprinkles|
|Carrot Cake||carrot||cream cheese||almonds|
Scroll all the way to the right in the table to see each column. And make sure your spelling is correct!