Object Oriented Programming Articles

Found 5,881 articles

How to Standardize Data in a Pandas DataFrame?

Tushar Sharma
Tushar Sharma
Updated on 27-Mar-2026 4K+ Views

Data standardization, also known as feature scaling, is a crucial preprocessing step that transforms data to have a mean of 0 and standard deviation of 1. This ensures all features contribute equally to machine learning algorithms. Pandas provides several methods to standardize DataFrame columns efficiently. What is Data Standardization? Standardization transforms data using the formula: z = (x - μ) / σ, where μ is the mean and σ is the standard deviation. This creates a standard normal distribution with consistent scale across all features. Method 1: Using StandardScaler from sklearn The most common approach uses ...

Read More

Is Python Object Oriented or Procedural?

Sri
Sri
Updated on 25-Mar-2026 5K+ Views

Python is a multi-paradigm programming language that supports both Object-Oriented Programming (OOP) and Procedural Programming. As a high-level, general-purpose language, Python allows developers to choose the programming style that best fits their needs. You can write programs that are largely procedural, object-oriented, or even functional in Python. The flexibility to switch between paradigms makes Python suitable for various applications, from simple scripts to complex enterprise systems. Object-Oriented Programming in Python Python supports all core OOP concepts including classes, objects, encapsulation, inheritance, and polymorphism. Here's an example demonstrating OOP principles ‒ class Rectangle: ...

Read More

How does Python\'s super() work with multiple inheritance?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 25-Mar-2026 1K+ Views

Python supports a feature known as multiple inheritance, where a class (child class) can inherit attributes and methods from more than one parent class. This allows for a flexible and powerful way to design class hierarchies. To manage this, Python provides the super() function, which facilitates the calling of methods from a parent class without explicitly naming it. The super() function follows Python's Method Resolution Order (MRO) to determine which method to call in complex inheritance hierarchies. Understanding Multiple Inheritance In multiple inheritance, a child class can derive attributes and methods from multiple parent classes. This can ...

Read More

What is the difference between del, remove and pop on lists in python ?

Sri
Sri
Updated on 25-Mar-2026 629 Views

When working with Python lists, you have three main methods to remove elements: remove(), del, and pop(). Each method serves different purposes and behaves differently depending on your needs. Using remove() The remove() method removes the first matching value from the list, not by index but by the actual value ? numbers = [10, 20, 30, 40] numbers.remove(30) print(numbers) [10, 20, 40] If the value doesn't exist, remove() raises a ValueError ? numbers = [10, 20, 30, 40] try: numbers.remove(50) # Value not in ...

Read More

How are arguments passed by value or by reference in Python?

Sri
Sri
Updated on 25-Mar-2026 14K+ Views

Python uses a mechanism known as Call-by-Object, sometimes also called Call by Object Reference or Call by Sharing. Understanding how arguments are passed is crucial for writing predictable Python code. If you pass immutable arguments like integers, strings or tuples to a function, the passing acts like Call-by-value. It's different when we pass mutable arguments like lists or dictionaries. Immutable Objects (Call-by-value behavior) With immutable objects, changes inside the function don't affect the original variable ? def modify_number(x): x = 100 print("Inside function:", x) num = ...

Read More

Detection of ambiguous indentation in python

Arjun Thakur
Arjun Thakur
Updated on 25-Mar-2026 677 Views

Indentation is a crucial feature of Python syntax. Code blocks in functions, classes, or loops must follow the same indent level for all statements within them. The tabnanny module in Python's standard library can detect violations in proper indentation. This module is primarily intended for command line usage with the -m switch, but it can also be imported in an interpreter session to check Python files for indentation problems. Command Line Usage To check a Python file for indentation issues, use the following command ? python -m tabnanny -q example.py For verbose output ...

Read More

How to sort a dictionary in Python by values?

Niharikaa Aitam
Niharikaa Aitam
Updated on 24-Mar-2026 2K+ Views

Python allows dictionaries to be sorted using the built-in sorted() function. In this article, we will explore different ways to sort a dictionary in Python by its values. Using itemgetter() Method The itemgetter() method from the operator module provides an efficient way to sort dictionaries by values. It returns a callable object that fetches an item from its operand using the provided index ? from operator import itemgetter dictionary = { 'b': 2, 'a': 1, 'd': 4, 'c': 3 ...

Read More

How to check Minlength and Maxlength validation of a property in C# using Fluent Validation?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 3K+ Views

FluentValidation is a popular .NET validation library that provides an easy way to validate model properties. The MinLength and MaxLength validators ensure that string properties meet specific length requirements, making them essential for input validation scenarios. Syntax Following is the syntax for using MaximumLength validator − RuleFor(x => x.PropertyName).MaximumLength(maxValue); Following is the syntax for using MinimumLength validator − RuleFor(x => x.PropertyName).MinimumLength(minValue); MaxLength Validator The MaximumLength validator ensures that the length of a string property does not exceed the specified maximum value. This validator is only valid on string properties. ...

Read More

How to create JLabel to hold multiline of text using HTML in Java?

Samual Sam
Samual Sam
Updated on 16-Mar-2026 1K+ Views

In Java Swing, the JLabel component by default displays only single-line text. To create a JLabel that can hold multiple lines of text, we need to use HTML formatting within the label text. This allows us to use HTML tags like for line breaks and other HTML formatting elements. Syntax Following is the syntax to create a multiline JLabel using HTML − JLabel label = new JLabel("Line1Line2"); For more complex formatting with alignment − JLabel label = new JLabel("Line1Line2", JLabel.LEFT); How It Works When a JLabel's text starts ...

Read More

How to do case insensitive string comparison of strings in JavaScript

Shubham Vora
Shubham Vora
Updated on 15-Mar-2026 2K+ Views

In this tutorial, we will learn how to do a case-insensitive string comparison of strings in JavaScript. Case insensitive comparison means strings should be considered equal regardless of whether they are written in lowercase or uppercase letters. This technique is commonly used in search functionality, where "TutorialsPoint" and "tutorialspoint" should be treated as identical. There are four main methods to perform case-insensitive string comparisons: toUpperCase() toLowerCase() localeCompare() RegExp() Using the toUpperCase() Method The toUpperCase() method converts all alphabetic ...

Read More
Showing 1–10 of 5,881 articles
« Prev 1 2 3 4 5 589 Next »
Advertisements