Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please refer to our video player troubleshooting guide for assistance.

Set Up and Inspect the Data

00:00 You’ve learned a lot about substring identification using Python so far, and in this last part of the course, we’re going to address yet another pretty common use case where you might want to find a substring inside of a pandas DataFrame column. So if you want to follow along with the examples I’m going to show here in the course, then make sure that you download the source materials, which includes a CSV file that has a bit of information that we’re working with.

00:29 You can find the material in the dropdown called Supporting Material underneath the video. And then you download the Sample Code ZIP file. You are also going to need to create and activate a virtual environment and install pandas. Once you’re set up with these, then you can start a Python interpreter and import pandas as pd, and you’ll work with a method on a pandas Series object that allows you to perform this substring check.

01:07 Here I’m in a Python environment where I have pandas installed, so I can go ahead and say import pandas as pd.

01:16 And I also have access to the companies.csv file. I have it in the same directory as I started this interpreter from, so I’m going to load it here by saying companies = pd.read_csv(), and then I give it the name, which is just "companies.csv".

01:37 And like I said before, you can get this file if you download the materials for this course. Okay, let’s take a quick look. companies.shape, so it’s got a thousand rows and two columns.

01:52 And let’s take a look at it as well.

01:57 So you’ve got one column that has a company name, and then another column that is a slogan for the company. And you want to do some search on this slogan column.

mindconnect dot cc on April 5, 2023

Where can I find this “companies.csv”?

Bartosz Zaczyński RP Team on April 5, 2023

@mindconnect dot cc You’ll find it in the supporting materials of the associated written tutorial. To download them, navigate to the mentioned tutorial and find the link labled “Click here to download sample code.”

Martin Breuss RP Team on April 5, 2023

@mindconnect dot cc thanks for the heads-up! Additionally to what @bartosz mentioned, you can also get now directly here in the course.

I’ve updated the code in the Supporting Material dropdown. When you download the Sample Code (ZIP) again, then you’ll also get the companies.csv file.

mindconnect dot cc on April 6, 2023

Wow lightening fast, thanks so much!

Martin Breuss RP Team on April 6, 2023

:) You’re welcome! Thanks for pointing this out!

Become a Member to join the conversation.