Class Inheritance in Python: Fundamentals for Data Scientists

Understand the basics with a concrete example!

Erdem Isbilen
5 min readJun 13, 2020
Photo by Nicole Wolf on Unsplash

Class inheritance is an important concept in object-oriented programming. It enables us to extend the abilities of an existing class. To create a new class, we use an available class as a base and extend its functionality according to our needs. Since we build a new class by using methods and data definitions available in the base class, development & maintenance time reduces and code reusability increases.

This post will introduce you basics of class inheritance in Python.

If you want to explore the basics of classes in Python, see my previous post below;

Let’s write a Python3 code that contains a simple example of class inheritance;

import pandas as pd
import random
# BASE CLASS
class CSVGetInfo:

""" This class displays the summary of the tabular data contained
in a CSV file """
instance_count = 0 # Initializer /

--

--

Erdem Isbilen

Machine Learning and Data Science Enthusiasts, Automotive Engineer, Mechanical Engineer, https://www.linkedin.com/in/erdem-isbilen/