
Let's understand the meaning with examples
Understanding the meaning of below is very important to understand data structure in python.
Ordering
Ordered data means data can be stored by following certain rule or order. For example, ascending order, descending order or any other custom criteria.
Indexing
Indexed data means data can be retrieved using its position in memory. Each element in data has a position. You can fetch an element in data by referring to it’s position in the data. First element gets position 0, next element gets position 1, next element gets position 2 and so on. This helps in accessing any element in data using it’s position.
Mutability
Data is considered mutable if it can change. If a data can not be changed, it’s called immutable. A data analyst has to perform many operations on data and many a times needs to update data. String and Tuple is immutable which means once you define string or Tuple, you can not change it. If any change is needed, you need to create a new variable.
Duplicates allowed
Can same value come more than once? Can the values repeat? Dictionaries does not allow repetition of keys. Sets does not allow repetition of elements. If a data analyst wants to store data without any duplicate values then SET is the preferred data structure. Dictionary is ideal for storing key value pair. Dictionary does not allow duplicate keys.
Use case of each data structure in python
List : When working with data which needs to be updated.
Tuple: When working with data which should not be changed.
Set: When you do not want to allow duplication in data.
Dictionary: When working with key : value paired data.
——-
Tech Concept Hub in Pune provides practical training in Data analytics. Here is the course syllabus for your reference Data Analytics Course Syllabus.