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:

column1 column2 column3
value1 value2 value3
value4 value5 value6



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 cupcakes.csv:

name cake_flavor frosting_flavor topping
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!

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?