From the course: Python for Data Science Tips, Tricks, & Techniques
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Inspect DataFrames with Pandas - Python Tutorial
From the course: Python for Data Science Tips, Tricks, & Techniques
Inspect DataFrames with Pandas
- [Instructor] After we've learned how to read data and parse it using Pandas, it's important to also know how to explore it. In this clip, what I'm going to show you is, essentially, how to read in a CSV file and just explore it a little bit using some basic functions. To get started, we need to import pandas so we'll say import pandas and give it the name, pd. Then, we'll create a dataframe by using the read CSV file and actually pulling in the data that is located locally with our exercise files. Take a look at that just by printing it out, as you can see here. Pretty straight-forward. We have a row key, the month, the product name, and the number of sales for that month. Now, if I just wanted to see the first 10 rows, I can use the head command and say, n=10. Similarly, I can do the last 10 rows by using the tail. And these are common if you've been working in Bash for a while. These are some basic head and tail options are ways of looking at files. We're essentially copying those…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.