SaiKrishna Tavva

SaiKrishna Tavva

80 Articles Published

Articles by SaiKrishna Tavva

80 articles

Generate Captcha using Python

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 27-Mar-2026 2K+ Views

A modified version of the PIL called Pillow library can be used to generate a text−based CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart) in Python. Types of CAPTCHA There are different types of CAPTCHA and some of them are as follows ? Text−based CAPTCHA − A sequence of characters is provided with features distorted and random noise to make character recognition difficult. ...

Read More

__init_subclass__ in Python

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 27-Mar-2026 3K+ Views

In Python, the __init_subclass__ method is a special method that allows us to initialize or customize class creation, particularly for subclasses. Key Characteristics of __init_subclass__ Some of the key aspects of the __init_subclass__ method are as follows: Automatic Invocation: The __init_subclass__ method is automatically called during the creation of a subclass and no need to manually invoke this method. Customizable via Parameters: To pass additional ...

Read More

Program to find sum of odd elements from list in Python

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 26-Mar-2026 8K+ Views

In Python, you can find the sum of all odd elements in an existing List using one of the following ways: Using List Comprehension Using a Loop Using filter() Function Using List Comprehension The List Comprehension method allows us to create ...

Read More

How to Merge all CSV Files into a single dataframe – Python Pandas?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 26-Mar-2026 17K+ Views

Merging multiple CSV files into a single DataFrame is a common task in data analysis. Python provides the glob module to find files matching patterns, and Pandas concat() to combine them efficiently. Using os.path.join() and glob Direct glob pattern matching Merging files in specific order ...

Read More

How to Sort CSV by multiple columns in Python ?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 26-Mar-2026 9K+ Views

In Python, to sort a CSV file by multiple columns, we can use the sort_values() method provided by the Python Pandas library. This method sorts DataFrame values by taking column names as arguments. Common methods for sorting a CSV file by multiple columns include ? sort_values() with inplace − Sort DataFrame by multiple columns, modifying the original sort_values() without inplace − Sort DataFrame by multiple columns, ...

Read More

Filter the rows – Python Pandas

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 26-Mar-2026 8K+ Views

In Python Pandas, filtering rows based on specific criteria is a common data manipulation task. The contains() method is particularly useful for filtering string columns by checking if they contain a specific substring. Basic Row Filtering with contains() The str.contains() method returns a boolean mask that can be used to filter DataFrame rows ? import pandas as pd # Create sample DataFrame data = { 'Car': ['Lamborghini', 'Ferrari', 'Lamborghini', 'Porsche', 'BMW'], 'Model': ['Huracan', 'F8', 'Aventador', '911', 'M3'], 'Year': [2020, 2021, 2019, 2020, 2018], ...

Read More

How to save a histogram plot in Python?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 26-Mar-2026 7K+ Views

When working with data visualization, plotting and saving a histogram on a local machine is a common task. This can be done using various functions provided by Python's Matplotlib, such as plt.savefig() and plt.hist(). The plt.hist() function is used to create a histogram by taking a list of data points. After the histogram is plotted, we can save it using the plt.savefig() function. Basic Example Here's a simple example that creates, saves, and displays a histogram − import matplotlib.pyplot as plt # Sample data data = [1, 3, 2, 5, 4, 7, 5, 1, ...

Read More

Python – Sort grouped Pandas dataframe by group size?

SaiKrishna Tavva
SaiKrishna Tavva
Updated on 26-Mar-2026 10K+ Views

To group Pandas data frame, we use groupby(). To sort grouped data frames in ascending or descending order, use sort_values(). The size() method is used to get the data frame size. Steps Involved The steps included in sorting the pandas data frame by its group size are as follows ? Importing the pandas library and creating a Pandas DataFrame. Grouping the columns by using the ...

Read More

Extract hyperlinks from PDF in Python

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

To extract hyperlinks from PDF in Python can be done using several libraries like PyPDF2, PDFminer, and pdfx. Each offers different approaches and capabilities for extracting URLs from PDF documents. PyPDF2: A Python built-in library that acts as a PDF toolkit, allowing us to read and manipulate PDF files. PDFMiner: A tool used for extracting information from PDF documents, focusing on getting and analyzing text data. ...

Read More

How do I change button size in Python Tkinter?

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

To change the size of Tkinter Button in Python's Tkinter library, we can use the width and height options of the Button widget in terms of text units (characters). Common Approaches We can change button size in Python Tkinter using several methods ? Using Width and Height − Set the width and height properties to determine button size in text units for text buttons. Adjusting Padding − Use padx and pady properties ...

Read More
Showing 1–10 of 80 articles
« Prev 1 2 3 4 5 8 Next »
Advertisements