Programming Articles

Page 97 of 2547

How to Compute Cross-Correlation of two given Numpy Arrays?

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 2K+ Views

Cross-correlation is a concept widely used in signal processing and image processing to determine the similarity between two signals or images. Python offers an efficient way to compute cross-correlation between numpy arrays using the numpy.correlate() function. The NumPy library provides numpy.correlate() for calculating cross-correlation of one-dimensional arrays. For two-dimensional arrays, we need to flatten them first and then use the same function. Syntax The syntax of the numpy.correlate() function is ? numpy.correlate(a, v, mode='valid') Parameters a, v ? Input arrays to calculate cross-correlation mode ? Size of output array ('valid', 'same', ...

Read More

How to Compress Images Using Python and PIL?

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 15K+ Views

In today's digital era, images have become a necessary part of our lives. They play an important and significant role in communication and expression across a wide range of platforms, from social media to websites. However, high−quality images can consume a considerable amount of storage space and it'll result in slower website loading times and longer upload times. Image compression becomes applicable in this situation. By reducing the size of an image, you can ensure faster loading times, lower bandwidth usage, and more storage space. In this article, we will look into the process of compressing images using Python ...

Read More

How to Compare two Dataframe with Pandas Compare?

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 1K+ Views

If you work with data analysis or data science, then you already know the importance of comparing DataFrames. Fortunately, the Python library, pandas, offers a handy compare() method that allows you to compare two DataFrames and highlight their differences. This method is incredibly useful for identifying discrepancies between datasets and making informed decisions based on those differences. In this article, we will explore how to use pandas compare() to compare two DataFrames and dive into some of the customization options available. Whether you're an experienced data analyst or a beginner, this article will provide you with the knowledge you ...

Read More

How to Compare JSON Objects Regardless of Order in Python?

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 13K+ Views

JSON (JavaScript Object Notation) is a widely used data format for exchanging data on the web. In Python, comparing JSON objects can be challenging when they contain the same elements but in different orders. This article explores three effective methods for comparing JSON objects regardless of their order. Method 1: Converting JSON to Dictionaries The simplest approach is converting JSON strings to Python dictionaries and comparing them directly. Since dictionaries are unordered in Python, this method naturally handles order differences ? import json # JSON objects to compare json_obj1 = '{"name": "John", "age": 30, "city": ...

Read More

How to Change Column Type in PySpark Dataframe

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 9K+ Views

PySpark DataFrames are powerful data structures for big data processing. One common task when working with DataFrames is changing column data types to ensure data consistency, perform accurate calculations, and optimize memory usage. In this tutorial, we will explore three methods to change column types in PySpark DataFrames: using cast(), withColumn(), and SQL expressions. Method 1: Using cast() Function The cast() function is the most straightforward way to convert a column from one data type to another. It takes the desired data type as an argument and returns a new column with the modified type. Syntax ...

Read More

How to Call a C Function in Python

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 10K+ Views

Calling C functions in Python can greatly enhance the capabilities of your programs by incorporating functionality from C libraries. Python offers various methods to seamlessly integrate C code, resulting in improved performance and access to low-level system APIs. This article explores different approaches including ctypes, CFFI, and Cython. Using the ctypes Library The Python ctypes library is a robust resource that empowers us to generate C-compatible data types and directly invoke functions in dynamic link libraries or shared libraries using Python. Step 1: Create a Simple C Library First, let's create a simple C function to ...

Read More

Higher-Lower Game with Python

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 7K+ Views

The Higher-Lower game is a classic and entertaining guessing game that challenges players to guess a randomly generated number within a specified range. By implementing this game using Python, beginners can gain valuable coding experience while creating an interactive and enjoyable gaming experience. In this article, we will explore the step-by-step process of creating a Higher-Lower game with Python, providing detailed explanations and code examples along the way. Whether you're a novice programmer looking to enhance your skills or simply seeking a fun coding project, this guide will help you build a fully functional game. Understanding the Game ...

Read More

GET Request Query Parameters with Flask using python

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 4K+ Views

Flask, a lightweight web framework for Python, provides developers with an intuitive and efficient way to handle GET request query parameters. When users interact with web applications, query parameters are often sent as part of the URL, conveying additional information to the server. With Flask, extracting and utilizing these query parameters becomes a seamless process. This article will explore GET request query parameters with Flask and Python. We will demonstrate practical examples that showcase how to effectively extract and manipulate query parameter data in your Flask applications. Understanding GET Requests and Query Parameters GET requests are a ...

Read More

Flask login without Database in Python

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 1K+ Views

Flask, a lightweight web framework for Python, offers various tools and libraries for building dynamic web applications. When it comes to implementing user authentication in Flask, developers often turn to traditional database systems. However, there are cases where using a database might be unnecessary or overkill, such as small-scale applications or rapid prototyping. In such scenarios, implementing a Flask login system without a database can be a simple and efficient solution. By using memory data structures and Flask's session object, developers can create a basic login system that stores user information without the need for a database. Setting Up ...

Read More

Exception Handling Of Python Requests Module

Prince Yadav
Prince Yadav
Updated on 27-Mar-2026 13K+ Views

Python Requests is a well-liked library for sending HTTP requests in Python. It provides a simple and natural method of interacting with websites and APIs. However, just like with any other programming task, handling exceptions correctly is crucial when working with the Requests module. You can handle errors politely and prevent your program from crashing or producing unexpected results by using exception handling. Understanding Exceptions An exception in Python is an occurrence that interferes with the regular flow of instructions while a program is being executed. The program halts execution when an exception is encountered and jumps to ...

Read More
Showing 961–970 of 25,466 articles
« Prev 1 95 96 97 98 99 2547 Next »
Advertisements