Class Inheritance in Python: Fundamentals for Data Scientists
Understand the basics with a concrete example!
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 /…