Server Side Programming Articles

Page 70 of 2109

Compute the outer product of two given vectors using NumPy in Python

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 418 Views

The outer product of two vectors is a matrix obtained by multiplying each element of the first vector with each element of the second vector. In NumPy, the outer product of vectors a and b is denoted as a ⊗ b. Outer Product Formula: a = [a₀, a₁, a₂, ...] b = [b₀, b₁, b₂, ...] a ⊗ b = a₀×b₀ a₀×b₁ a₀×b₂ a₁×b₀ a₁×b₁ a₁×b₂ a₂×b₀ a₂×b₁ a₂×b₂ ...

Read More

Python - Chuncked summation every K value

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 320 Views

Chunked summation, also known as partial sum or rolling sum, is a process of calculating the sum of elements in smaller chunks or subsets rather than processing the entire sequence at once. Each chunk represents a group of consecutive elements from the sequence, and the sum is calculated for each chunk individually. For example, consider the sequence [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], and let's calculate the chunked sum with a chunk size of 3 ? Chunk 1: [1, 2, 3] → Sum: 1 + 2 + 3 = ...

Read More

Python - Check possible bijection between a sequence of characters and digits

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 426 Views

In mathematics, a bijection refers to a function that establishes a one-to-one correspondence between two sets. Each element in one set has a unique and distinct counterpart in the other set, with no duplicates or missing elements in the mapping. In Python, checking for a bijection involves validating whether a one-to-one mapping exists between elements of two sequences. For character-digit sequences, we need to ensure each character maps to exactly one digit and vice versa. Algorithm for Checking Bijection To check for a possible bijection between a sequence of characters and digits, follow these steps: ...

Read More

Python - Check Numeric Suffix in String

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 599 Views

A suffix refers to characters added to the end of a string. In programming, checking for numeric suffixes is a common task when processing filenames, user IDs, or data validation. A numeric suffix means the string ends with one or more digits. For example, in the string "example123", the suffix "123" is numeric. Similarly, "hello_world7" has a numeric suffix "7", while "hello_world" has no numeric suffix. Python provides several approaches to check if a string has a numeric suffix. Let's explore the most effective methods. Using Regular Expressions The re module provides powerful pattern matching capabilities. ...

Read More

Check if a tuple exists as dictionary key in Python

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 2K+ Views

A Dictionary is one of the data structures available in Python which stores data in key-value pairs. It is mutable and unordered, with unique keys but duplicate values allowed. Keys and values are separated by a colon (:). A tuple is an ordered, immutable collection of elements enclosed in parentheses (), separated by commas. Since tuples are immutable, they can be used as dictionary keys. Here's an example of a dictionary using tuples as keys ? Example my_dict = {('apple', 'banana'): 1, ('orange', 'grape'): 2} print(my_dict) {('apple', 'banana'): 1, ('orange', 'grape'): 2} ...

Read More

Clustering, Connectivity and other Graph properties using Python Networkx

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 1K+ Views

Python NetworkX is a popular open-source Python library used for the creation, manipulation, and analysis of complex networks or graphs. It provides a wide range of tools, algorithms, and functions to work with graphs, making it a valuable resource for network analysis and research. Python NetworkX allows us to represent and work with different types of graphs, such as directed graphs, undirected graphs, multigraphs (graphs with multiple edges between nodes), and weighted graphs (graphs with edge weights). It also provides a simple and intuitive interface for creating, adding nodes and edges, and performing various operations on graphs. Installation ...

Read More

Complexity Cheat Sheet for Python Operations

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 1K+ Views

Time complexity measures how algorithm execution time grows with input size. It uses Big O notation to set an upper bound on worst-case performance. Understanding complexity helps you choose the right data structures and optimize your code. For example, an O(n) algorithm takes twice as long with double input size, while an O(n²) algorithm takes four times longer with double input size. List Time Complexity Lists are implemented as dynamic arrays in Python. Here's the time complexity cheat sheet for list operations ? Operation Average Case Amortized Worst Case ...

Read More

Comparing and Managing Names Using name-tools module in Python

Niharika Aitam
Niharika Aitam
Updated on 27-Mar-2026 269 Views

The name-tools module is a Python library that provides tools for working with human names. It's commonly used in data cleaning, text processing, and Natural Language Processing applications. This module offers several functions for comparing, parsing, and standardizing names. Installing name-tools Before working with name-tools, you need to install it in your Python environment ? pip install name-tools After successful installation, you'll see confirmation messages indicating that name-tools has been installed properly. The split() Method The split() method parses a full name into four components: prefix, first name, last name, and suffix. ...

Read More

Welch’s T-Test in Python

Jaisshree
Jaisshree
Updated on 27-Mar-2026 671 Views

Python is a powerful language for performing various statistical tests. One such statistical test is the Welch's t-test. When there are two datasets with equal variances and you need to compare their means, a two-sample t-test works well. However, if the variances of the two datasets are unequal, then Welch's t-test should be used to compare the means more accurately. Syntax stats.ttest_ind(dataset_one, dataset_two, equal_var=False) Parameters The ttest_ind() function takes three parameters: dataset_one − The first dataset as an array or list dataset_two − The second dataset as an array or list ...

Read More

How to Clean String Data in a Given Pandas DataFrame?

Mukul Latiyan
Mukul Latiyan
Updated on 27-Mar-2026 2K+ Views

String data in Pandas DataFrames often requires cleaning before analysis. This includes removing whitespace, handling special characters, standardizing case, and dealing with missing values. Pandas provides powerful string methods through the .str accessor to handle these tasks efficiently. Creating Sample Data Let's start with a DataFrame containing messy string data ? import pandas as pd # Create sample data with common string issues data = { 'Name': [' John Doe ', 'JANE SMITH', ' mary johnson ', ' Bob Wilson '], 'Email': ['john@EXAMPLE.com', 'jane@example.COM', 'mary@Example.com', ...

Read More
Showing 691–700 of 21,090 articles
« Prev 1 68 69 70 71 72 2109 Next »
Advertisements