Dataframes are the basis of Pandas. Dataframes are like Excel Sheets, effectively. They’re tables that contain information formatted as rows and columns. Click the next cell, and press Shift+Enter, and run it. This cell first creates a dictionary and then converts it to a dataframe. The table that has appeared below the cell is what a dataframe looks like.
There are many operations on Dataframes, but there are only a few we’ll be using.
.head() is one of the most useful dataframe methods. This operation produces the top or head of a dataframe. The operation gives the first 5 rows by default, but you can specify any number n of rows as
Run the next two cells. These will give the top of a data frame. We use
.head() to get a sense of what the dataframe is like, before we work on it.
We’ll cover more Dataframe operations soon, but we’ll do it as part of the ML we do. For now, however, let’s review Python first.