We've checked our data's size and structure. But what does the actual data look like? It's time to peek at the real values inside our DataFrame to get a feel for the content.
Engagement Message
Why is it important to see the actual data instead of just summaries?
To see the first few rows of your DataFrame, you can use the .head() method. By default, df.head() will show you the top 5 rows. This gives you a quick first impression of your dataset.
Engagement Message
What insights can you gain from just the first few rows of a dataset?
Using .head() is like sampling the top of a document. It helps you quickly confirm that your columns have the right kind of data and that everything loaded correctly. It's a crucial first "sanity check" for any analyst.
Engagement Message
What kind of problem might you spot by looking at just the first few rows?
What if you want to see the end of your data? For that, Pandas provides the .tail() method. As you might guess, df.tail() shows you the last 5 rows of your DataFrame, giving you a view from the bottom up.
Engagement Message
In what situation might looking at the last few rows be more useful than the first few?
You can also control how many rows you see by passing a number inside the parentheses. For example, shows the first three rows, and shows the last ten. This gives you more control over your preview.
