Jaisshree

Jaisshree

95 Articles Published

Articles by Jaisshree

Page 3 of 10

Filter Pandas DataFrame Based on Index

Jaisshree
Jaisshree
Updated on 27-Mar-2026 682 Views

Pandas DataFrame filtering based on index is a fundamental operation for data analysis. The filter() method and boolean indexing provide flexible ways to select specific rows and columns based on their index labels. Syntax df.filter(items=None, like=None, regex=None, axis=None) Parameters items: List of labels to keep. Returns only rows/columns with matching names. like: String pattern. Keeps labels containing this substring. regex: Regular expression pattern for matching labels. axis: 0 for rows, 1 for columns. Default is None (columns). Filtering by Numeric Index Positions Use iloc[] to filter rows by their ...

Read More

FileExtensionValidator – Validate File Extensions in Django

Jaisshree
Jaisshree
Updated on 27-Mar-2026 1K+ Views

Django's FileExtensionValidator is a built-in validator that ensures uploaded files have specific extensions. This validator helps maintain security and data integrity by preventing unwanted file types from being uploaded to your application. What is FileExtensionValidator? The FileExtensionValidator allows you to specify which file extensions are allowed or forbidden for FileField and ImageField uploads. It's particularly useful for controlling file types in forms and preventing security vulnerabilities. Basic Usage Here's how to use FileExtensionValidator in your Django models ? from django.db import models from django.core.validators import FileExtensionValidator class Document(models.Model): # ...

Read More

Fibonacci Search Visualizer using PyQt5

Jaisshree
Jaisshree
Updated on 27-Mar-2026 386 Views

The Fibonacci Search is an efficient algorithm for searching sorted arrays using Fibonacci numbers. Here, we'll create a visual demonstration of this algorithm using PyQt5 to help understand how it divides the search space. How Fibonacci Search Works The algorithm uses Fibonacci numbers to divide the sorted array into unequal parts, similar to binary search but with golden ratio proportions. It finds two consecutive Fibonacci numbers that are greater than or equal to the array length. Algorithm Steps Step 1: Find the smallest Fibonacci number greater than or equal to the array length. Step 2: ...

Read More

Fernet (Symmetric Encryption) using a Cryptography Module in Python

Jaisshree
Jaisshree
Updated on 27-Mar-2026 5K+ Views

Symmetric encryption is a cryptographic technique where the same key is used for both encryption and decryption of messages. The Fernet module from Python's cryptography library provides a simple, secure implementation of symmetric encryption using the AES algorithm. How Symmetric Encryption Works Symmetric encryption follows these key steps − Key generation − A secret key is generated and shared between sender and receiver for encrypting and decrypting messages. Encryption − The sender converts plaintext into unreadable ciphertext using the secret key. Transmission − The encrypted ciphertext is ...

Read More

Difference Between Tensor and Variable in Pytorch

Jaisshree
Jaisshree
Updated on 27-Mar-2026 402 Views

PyTorch is an open-source Python library used for machine learning, computer vision and deep learning. It is an excellent library to build neural networks, conduct complex computations and optimize gradient differentiation. Developed by Facebook's Research Team (FAIR), it gained popularity due to its dynamic computing graphs, allowing it to change graphs in real time. This was revolutionary back in 2016 when models working in real-time just started to emerge. There are two main data structures to understand in PyTorch: Tensor and Variable. Let's explore their differences and evolution. What is a Tensor? A Tensor is used ...

Read More

Difference between str.capitalize() vs str.title()

Jaisshree
Jaisshree
Updated on 27-Mar-2026 935 Views

In Python, strings are immutable sequences of characters that can be manipulated using various built-in methods. Two commonly used string methods are capitalize() and title(), which both modify the case of characters but work differently. str.capitalize() The capitalize() method converts only the first character of the entire string to uppercase and makes all remaining characters lowercase. It treats the entire string as a single unit, regardless of spaces or word boundaries. Syntax str_name.capitalize() Here, str_name is the input string. The method takes no arguments and returns a new string. Example ...

Read More

Difference between Shallow Copy vs Deep Copy in Pandas Dataframe

Jaisshree
Jaisshree
Updated on 27-Mar-2026 492 Views

One of the most useful data structures in Pandas is the DataFrame — a 2-dimensional table-like structure containing rows and columns to store data. Understanding the difference between shallow and deep copies is crucial when manipulating DataFrames, as it affects how changes propagate between original and copied objects. What is Shallow Copy? A shallow copy creates a new DataFrame object that references the original data. The copied DataFrame points to the same memory location as the original DataFrame. Any modifications to the underlying data will affect both the original and shallow copy. Syntax df_shallow = ...

Read More

Difference between Shallow and Deep Copy of a Class

Jaisshree
Jaisshree
Updated on 27-Mar-2026 2K+ Views

A class is a blueprint that defines objects' attributes (data) and behaviors (methods). When working with class instances, you often need to create copies. Python provides two types of copying: shallow copy and deep copy, each with different behaviors regarding nested objects. Shallow Copy Shallow copy creates a new object but stores references to the original elements. Instead of duplicating nested objects, it copies their references. This means modifications to nested objects affect both the original and the copy. Shallow copy is performed using copy.copy() method from the copy module. Deep Copy Deep copy creates ...

Read More

Difference Between Queue and Collestions in Python

Jaisshree
Jaisshree
Updated on 27-Mar-2026 293 Views

In Python, a queue is a data structure that follows FIFO (First In First Out) principle, where elements are processed in the exact order they were added. Python provides two main approaches for queue implementation: queue.Queue and collections.deque, each with distinct characteristics suited for different scenarios. Key Differences Category queue.Queue collections.deque Thread Safety Thread-safe with built-in synchronization for multithreading Not thread-safe by default, requires external synchronization Functionality Designed specifically for FIFO operations with put() and get() methods Double-ended queue supporting both FIFO and LIFO with methods like append(), pop(), popleft() ...

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
Showing 21–30 of 95 articles
« Prev 1 2 3 4 5 10 Next »
Advertisements