Programming Articles

Page 82 of 2547

Python for IoT Applications: Controlling and Monitoring Devices

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

Internet of Things (IoT) technologies enable us to connect and control devices remotely, transforming how we interact with the physical world. Python has emerged as a preferred language for IoT development due to its simplicity, extensive libraries, and seamless hardware integration capabilities. Controlling Devices with Python Python offers powerful libraries for controlling hardware components like sensors, actuators, and microcontrollers. The RPi.GPIO library is commonly used for Raspberry Pi GPIO control. LED Control Example Here's how to control an LED connected to a Raspberry Pi ? import RPi.GPIO as GPIO import time LED_PIN = ...

Read More

How to open an image from the URL in PIL?

Tarun Singh
Tarun Singh
Updated on 27-Mar-2026 6K+ Views

PIL (Python Imaging Library) is a widely used Python library that enables developers to work with image files. It offers a broad range of functionalities for manipulating and handling image files, such as opening and resizing them, converting between different formats, and more. One frequently encountered task when working with images involves opening an image file from a URL. This is especially useful when working with images that are stored on a remote server, such as those obtained from an online database or a website. In this article, we will learn how to open an image from the ...

Read More

How to not get caught while web scraping?

Tarun Singh
Tarun Singh
Updated on 27-Mar-2026 413 Views

Web scraping is a powerful technique used for market research, price monitoring, and content aggregation. However, it comes with legal and ethical challenges, especially when conducted without the website owner's consent. Many websites implement anti-scraping measures to prevent automated data extraction, while others may pursue legal action against violators. In this article, we will explore effective strategies to conduct web scraping responsibly while avoiding detection and legal issues. Why Web Scraping Can Be Complicated? Web scraping presents several challenges that developers must navigate carefully − Violating terms of service − Many websites explicitly prohibit automated ...

Read More

How to normalize a NumPy array so the values range exactly between 0 and 1?

Tarun Singh
Tarun Singh
Updated on 27-Mar-2026 4K+ Views

NumPy is a powerful library in Python for numerical computing that provides an array object for the efficient handling of large datasets. Often, it is necessary to normalize the values of a NumPy array to ensure they fall within a specific range. One common normalization technique is to scale the values between 0 and 1. In this article, we will learn how to normalize a NumPy array so the values range exactly between 0 and 1. We will explore different approaches that can be used to achieve this using NumPy and scikit-learn, along with syntax and complete examples. ...

Read More

How to Merge Two Pandas DataFrames on Index?

Tarun Singh
Tarun Singh
Updated on 27-Mar-2026 3K+ Views

Merging two Pandas DataFrames on index is essential when you have datasets sharing common row identifiers but containing different columns. This operation combines data horizontally, creating a unified dataset for analysis. In this article, we will explore three methods to merge Pandas DataFrames based on their index: merge(), join(), and concat(). What is a Pandas DataFrame? A DataFrame is Pandas' primary two-dimensional data structure, similar to a spreadsheet or SQL table. It consists of labeled rows and columns where each column can contain different data types (integers, floats, strings, etc.). The row labels form the index, while ...

Read More

How to merge two csv files by specific column using Pandas in Python?

Tarun Singh
Tarun Singh
Updated on 27-Mar-2026 5K+ Views

CSV (Comma Separated Values) files are widely used for storing and exchanging data in a simple format. In many data processing tasks, it is necessary to merge two or more CSV files based on a specific column. Fortunately, this can be easily achieved using the Pandas library in Python. In this article, we will learn how to merge two CSV files by a specific column using Pandas in Python. What is Pandas Library? Pandas is an open-source library for data manipulation and analysis in Python. It provides high-performance data structures and tools for working with structured data, ...

Read More

How to Merge “Not Matching” Time Series with Pandas?

Tarun Singh
Tarun Singh
Updated on 27-Mar-2026 3K+ Views

Time series data is crucial for many business operations, especially in finance and manufacturing. These datasets often come in multiple tables with specific subsets of data. Merging tables with non-matching timestamps can be challenging, but Pandas provides powerful tools to handle this task effectively. In this article, we will learn how to merge time series data with non-matching timestamps using Pandas. We'll explore different merge techniques including inner join, outer join, left join, and the specialized merge_asof() function for time-series data. Using Inner Join An inner join returns only rows with matching timestamps in both DataFrames. Any ...

Read More

How to Use cbind in Python?

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 890 Views

Python doesn't have a built-in cbind function like R, but you can achieve column binding (combining columns from different data structures) using various methods. The term "cbind" stands for column bind, which means combining arrays or data structures side-by-side column-wise. Using zip() with List Comprehension The zip() function combines elements from multiple iterables, while list comprehension creates a new list by processing the zipped elements ? Syntax zip(iterable1, iterable2, ...) Example column1 = [1, 2, 3] column2 = [4, 5, 6] column3 = [7, 8, 9] combined = [list(t) for ...

Read More

How to Use axis=0 and axis=1 in Pandas?

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 8K+ Views

In Pandas, the axis parameter controls the direction of operations on DataFrames and Series. Understanding axis=0 and axis=1 is essential for performing row-wise and column-wise operations efficiently. Understanding Axis in Pandas A Pandas DataFrame is a two-dimensional table with rows and columns. The axis parameter determines how operations are applied: Axis 0 (rows) − Operations are applied along rows, working down vertically. Results are computed across rows for each column. Axis 1 (columns) − Operations are applied along columns, working across horizontally. Results are computed across columns for each row. ...

Read More

How to use a List as a dictionary key in Python 3?

Asif Rahaman
Asif Rahaman
Updated on 27-Mar-2026 326 Views

Dictionaries are among the most powerful data structures in Python. They consist of key-value pairs and offer O(1) time complexity for accessing values. However, you cannot directly use lists as dictionary keys because lists are mutable and therefore not hashable. Why Lists Cannot Be Dictionary Keys Lists are mutable data types in Python, meaning their contents can be modified after creation. Dictionary keys must be hashable (immutable) because Python uses hash values to efficiently store and retrieve key-value pairs. If a list's contents change after being used as a key, its hash value would change, making it impossible ...

Read More
Showing 811–820 of 25,466 articles
« Prev 1 80 81 82 83 84 2547 Next »
Advertisements