Difference Between Primitive and Non-Primitive Data Types

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 would like to perform on encapsulated data. This abstraction allows data scientists to focus on the bigger picture of the problem and not worrying about the relationship between the data and its interface to required operations. Looking focus of the bigger picture is a common problem when a low level language is selected for implementation of solution.

From this perspective Python is one of the most valuable tool in data science. Data structure is basically 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 the basic data structures are the building blocks for data manipulation. They contain pure and simple values of a data. In Python there are four types of primitive variable:


Integers can be used to represent numeric data. Generally, these are used to represent whole numbers from negative infinity to infinity.


Floating points can be used for rational numbers, usually ending with a decimal figure.


The collections of alphabets, words or other characters is known as strings. Strings can be created in Python by enclosing a sequence of characters within a pair of single or double quotes.


Boolean is the 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 are further divided:


In Python a compact way of collecting basic data types is array. It is must that all the entries in an array be of the same data type.


In order to store collection of heterogeneous items in Python “Lists” are used. 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 ,.


In the data science industry big data is commonplace. A programming language would hardly be useful without the capability to store and retrieve previously stored information.

Got A Data Science Question?

Ask our experts anything about machine learning, analytics or statistics.