Importing Datasets

Learn to Code Today!

Learn 10x faster: coding, no-code and data skills. Join millions of users mastering new tech skills and accelerating their career with Enki.
Get started

This is part of the “Intro to Data Analysis with Python” series of posts, with content from the Enki app. If you stumbled upon this, you could start from the beginning.

Previously we learned how to create a Series and a DataFrame and what they are.

Now we will learn how to import a dataset into a DataFrame.

Before that, we should first decide if we are importing from an external or a local source. After that, we have to decide what type of file we want to import.

For now, we will import a CSV file called "netflix_titles.csv".

Imported Dataset

If we are importing externally, we can just use pandas .read_csv module with the URL  inside.

On the other hand, if we are importing from a local source, we first have to make sure the file is in our working Python directory[1].

Now we can import it into our project.

💡 Add this code to the same notebook we created in the previous workout.

If you want to use the same dataset, you can download it using the link in the Learn More section.

Footnotes

[1: Working Directory]

To check your current working directory, you have to first import the os library and use its .getcwd() module.

The .getcwd() module will output the current working directory.

Just locate the folder using the path provided by the .getcwd() module and move the CSV file there.

To check if a file is in a specific folder, we need to use the .listdir() method from the same module:

We can print the files in a list:

Or use a for loop:

Learn More

About Enki

  • Fully personalized online up-skilling
  • Unlimited AI coaching
  • Designed by Silicon Valley experts

More articles

Meet your AI-enabled coach

Professional athletes have a coach for every aspect of their performance. Why can’t you for your work? Enki’s AI-powered coaching on-demand - combined with state of the art, structured learning content - makes this a reality.
1
1:1 AI Coaching
How do I remove duplicate emails?
Convert the list to a set and back to a list. Sets automatically remove duplicates.
2
Personalized Exercises
3
Interactive practice

Unlock full access to all skills on Enki with a 7-day free trial

Get started