Python Articles

Page 143 of 855

__future__ Module in Python

Sarika Singh
Sarika Singh
Updated on 27-Mar-2026 582 Views

The __future__ is a built-in Python module that allows you to import features from newer versions of Python into older versions. This enables forward compatibility and helps write code that works consistently across Python versions. What is the __future__ Module? The __future__ module is primarily used when migrating code from Python 2 to Python 3, or when you want to test new language features before they become default in future releases. It ensures your code behaves the same way across different Python versions. For example, in Python 2, dividing two integers returns an integer. By importing the ...

Read More

Full outer join in PySpark dataframe

Atharva Shah
Atharva Shah
Updated on 27-Mar-2026 2K+ Views

A Full Outer Join is an operation that combines the results of a left outer join and a right outer join. In PySpark, it is used to join two dataframes based on a specific condition where all the records from both dataframes are included in the output regardless of whether there is a match or not. This article will provide a detailed explanation of how to perform a full outer join in PySpark and provide a practical example to illustrate its implementation. Installation and Setup Before we can perform a full outer join in PySpark, we need to ...

Read More

Python program to print an Array

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 3K+ Views

In Python, an array (or list) is a collection of elements stored in a single variable with contiguous memory locations. Each element can be accessed using its index, which starts from 0 for the first element. Python lists are dynamic and can store homogeneous elements of the same datatype. The index represents the position of each element, ranging from 0 to n-1 for an array with n elements. Array Indexing Array indices are the position numbers used to access elements. The first element is at index 0, the second at index 1, and so on. For an ...

Read More

Python Program to Sort the 2D Array Across Columns

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 3K+ Views

When a two-dimensional array or a 2D array is declared, it is treated like a matrix with rows and columns. Sorting a 2D array across columns means sorting the elements within each column independently, either in ascending or descending order. Understanding Column-wise Sorting Consider this 2D array ? import numpy as np # Original 2D array arr = [[7, 9, 5, 7], [9, 5, 9, 4], [2, 7, 8, 6], [8, ...

Read More

Python Program to Remove Duplicate Elements From an Array

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 2K+ Views

An array is a collection of elements of the same data type, where each element is identified by an index value. It is the simplest data structure where each data element can be accessed directly using its index number. Arrays in Python Python does not have a specific data structure to represent arrays. Here, we can use a List as an array ? [6, 4, 1, 5, 9] 0 1 2 3 4 The indexing in Python starts from 0. In the above example, the integers 6, 4, 1, ...

Read More

Python Program to Remove All Occurrences of an Element in an Array/List

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 5K+ Views

An array is a collection of elements of homogeneous datatypes stored in contiguous memory locations. Python does not provide built-in arrays, but you can use lists or import the array module. Lists are more flexible as they can contain different data types. The task is to remove all occurrences of a specific element from a list, including duplicates. Let's explore different approaches to accomplish this ? Input Output Scenario Consider a list with repeated elements ? my_list = [1, 10, 20, 10, 21, 16, 18, 10, 22, 10, 8, 10] print("Original list:", my_list) print("Element 10 ...

Read More

Which is Used More for DevOps: Ruby or Python?

Tushar Sharma
Tushar Sharma
Updated on 27-Mar-2026 367 Views

DevOps has become a fundamental part of modern software development, emphasizing collaboration between development and operations teams. When choosing a programming language for DevOps workflows, Ruby and Python are two popular contenders, each offering unique strengths for automation, monitoring, and deployment tasks. This article compares Ruby and Python in the DevOps context, examining their popularity, toolchain integration, and practical use cases to help you make an informed decision. Ruby vs Python: Overview Ruby Created in 1995 by Yukihiro Matsumoto, Ruby is a dynamic, object-oriented language emphasizing simplicity and productivity. Ruby gained widespread popularity through Ruby on ...

Read More

Python program to print the Boundary elements of a Matrix

Nikhitha Chowdary Manne
Nikhitha Chowdary Manne
Updated on 27-Mar-2026 879 Views

The boundary elements of a matrix are elements located on the outer edges: first row, last row, first column, or last column. These elements form the perimeter of the matrix. Understanding Boundary Elements Consider this 3×3 matrix ? 9 8 7 6 5 4 3 2 1 The boundary elements are: 9, 8, 7, 6, 4, 3, 2, 1. The middle element 5 is not a boundary element since it's surrounded by other elements. Algorithm Step 1 − Traverse the matrix using nested loops (outer ...

Read More

What is the Best Python Library for Hidden Markov Models?

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

Hidden Markov Models (HMMs) are powerful statistical models used for modeling sequential data with hidden states. They find applications in speech recognition, natural language processing, finance, and bioinformatics. Python offers several specialized libraries for implementing HMMs, each with unique strengths and limitations. Understanding Hidden Markov Models Before exploring the libraries, let's understand HMMs fundamentals. An HMM represents a system that transitions between hidden states over time, consisting of: A set of hidden states An initial state probability distribution A state transition probability matrix An observation probability matrix The goal is to infer the most ...

Read More

What are the Resources for Learning Advanced Python Programming?

Tushar Sharma
Tushar Sharma
Updated on 27-Mar-2026 390 Views

Python's demand as a programming language has driven it to a wealth of resources for learning its different aspects. While beginners have various tutorials and guides to help them get started, advanced learners often struggle to find resources that cater to their specific needs. In this article, we'll explore the range of resources aimed at taking your Python skills to the next level, covering topics such as advanced language features, design patterns, performance optimization, and more. Advanced Python Language Features To get the most out of Python, it's important to master its advanced language features. These features enable ...

Read More
Showing 1421–1430 of 8,549 articles
« Prev 1 141 142 143 144 145 855 Next »
Advertisements