From the course: Python Data Science Mistakes to Avoid
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Not choosing the right data structure - Python Tutorial
From the course: Python Data Science Mistakes to Avoid
Not choosing the right data structure
- [Instructor] When working with data, a common mistake is choosing the wrong data structures. In this video, I will walk through a couple of examples to show you how to select data structures that are best suited for your goals. For example, let's say that I have information about the types of pets in a household and I need to check whether certain types of pets are part of that household or not. If I choose to store the data in a list, I will be able to perform searches but a list would not be the most efficient data structure in this context. Also given the nature of the goal here, the data does not need to be stored in an ordered manner, which is another indication that storing the data in a list is not necessary. Instead, the data can be stored in a set. It would look something like this. If I wanted to perform a search to see if bunny is in this set of data, I would do something like this. And if I wanted to…
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.