Niharika Aitam

Niharika Aitam

133 Articles Published

Articles by Niharika Aitam

Page 8 of 14

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

How to remove axes spine from the plot in seaborn?

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

The axes spines, also known as the axis lines, are the lines that define the borders or boundaries of a plot's coordinate system. In a two-dimensional plot, there are typically four axes spines: top, bottom, left, and right. These spines create the framework for the plot and serve as reference lines for the data points. Each spine represents one of the four sides of the plot. The top spine runs horizontally across the top, the bottom spine runs horizontally across the bottom, the left spine runs vertically along the left side, and the right spine runs vertically along the ...

Read More

CMY and CMYK Color Models using Python

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

The CMY and CMYK color models are subtractive color models used in printing and graphic design. In Python, we can work with these color models using libraries like matplotlib and PIL to create, manipulate, and visualize colors. CMY Color Model The CMY color model, also known as the subtractive color model, is a system used for mixing colors in printing, painting, and graphic design. CMY stands for Cyan, Magenta, and Yellow, which are the primary colors in this model. In the CMY color model, colors are created by subtracting different amounts of cyan, magenta, and yellow pigments ...

Read More

How to change the figure style to Ticks in Seaborn?

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

In Seaborn, the ticks figure style is a minimalistic style that removes the background grid lines but retains the tick marks on the axes. This style focuses on presenting the data without any distracting elements and is useful when we want a clean and simple look for our plots. What the Ticks Style Does When we set the figure style to ticks in Seaborn using the sns.set_style() function, the following changes occur in our plots: Background Grid Lines − The background grid lines are removed, resulting in a blank canvas without any horizontal or vertical lines. ...

Read More

What is the way to convert the figure style to Whitegrid in Seaborn?

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

Seaborn is a popular data visualization library in Python that provides a variety of styles to enhance the visual appearance of plots. One of the available styles is "whitegrid, " which offers a clean white background with subtle grid lines that make data easier to read and interpret. In this article, we'll explore how to convert the figure style to whitegrid in Seaborn and demonstrate its usage with practical examples. Setting Up the Environment First, ensure you have Seaborn installed in your Python environment. You can install it using pip ? pip install seaborn ...

Read More
Showing 71–80 of 133 articles
« Prev 1 6 7 8 9 10 14 Next »
Advertisements