A data structure is a way to organize and store data so that data can be accessed and edited efficiently. The data structures are an abstraction around data and the operations one would like to perform on encapsulated data.
The abstraction allows data scientists to focus on the bigger picture of the problem and not worry about the relationship between the data and its interface to the required operations.
Losing focus of the bigger picture is a common problem when we use a low-level language for implementation of the solution.
Python for Implementation of Abstraction
Data structure is the implementation of the abstract data type. This implementation requires the physical representation of the data using different programming structures and basic types of data. Python has two types of data structures or data types:
1. Primitive Data Structures:
The primitive or basic data structures are the building blocks for data manipulation. They contain pure and simple values of data. In Python, there are four types of primitive variable:
In Python, we used Integers to represent numeric data. Generally, Integers data types store whole numbers from negative infinity to infinity.
Floating points can be used for rational numbers, usually ending with a decimal figure.
Strings are the collections of alphabets, words, or other characters. We create strings Python by enclosing a sequence of characters within a pair of single or double-quotes.
Boolean is a built-in data type. It only takes two values True or False; these are interchangeable with the integers 1 and 0.
2. Non-Primitive Data Structures:
Non-primitive not just store a value, but rather a collection of values in various formats. The non-primitive data structures get further categorized into the following data types:
In Python, a compact way of collecting basic data types is an array. It is just that all the entries in an array be of the same data type.
We used lists to store a collection of heterogeneous items in Python. You can change their content without changing their identity. Lists can be recognized by their square brackets [ and ] that hold elements, separated by a comma.
Big data is commonplace in the data science. A programming language would hardly be useful without the capability to store and retrieve previously stored information.
Python For Kids
Don't forget to check out Python For Kids and Free Teaching Material article. You can download slides of 3 weeks course, delivered by Datalya with the help of Dr. Nasir Mahmood.
Download Free Learning Material