Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Flight-price checker using Python and Selenium
Web scraping has been a useful technique for extracting data from websites for various purposes, including price checking for airline tickets. In this article, we will explore how to build a flight price checker using Selenium, a popular web automation tool. By leveraging Selenium's capabilities, we can automate the process of collecting and comparing prices for flights across different airlines, saving time and effort for users. Prerequisites and Setup Before we start building our flight price checker, we need to set up the required tools and dependencies. Installing Required Packages We'll use the modern approach with ...
Read MoreFlattening JSON objects in Python
JSON (JavaScript Object Notation) is a lightweight data interchange format extensively used in web applications for transmitting data between servers and clients. JSON data often comes in nested formats, which can be difficult to manipulate and analyze. Flattening JSON objects involves converting complex hierarchical JSON structures into simpler, flat key-value pairs. What is JSON Flattening? JSON flattening transforms nested objects into a single-level dictionary where nested keys are combined using a separator (commonly underscore). This process is essential when working with databases, data analysis, or when you need to convert complex JSON into tabular formats. Method 1: ...
Read MoreFlask project – Create a Joke App with PyJokes
Flask is an excellent choice for Python developers who want to build web applications. It is a lightweight web framework that is easy to use and understand. Using PyJokes, a Python package that provides a collection of programming jokes, we'll show you how to create an amusing and interactive joke app with Flask. Installation To get started with our Flask joke application, we need to install Flask and the pyjokes library ? pip install pyjokes flask Flask Basics A Flask application typically consists of routes, which are URLs that map to Python functions. ...
Read MoreFlask NEWS Application Using Newsapi
Python developers can create web applications using the lightweight Flask web framework. This article demonstrates building a news application using the News API, which gathers headlines and articles from various news sources. Installation and Setup First, install the required packages using pip ? pip install newsapi-python flask You'll also need to obtain a free API key from newsapi.org by creating an account. Basic Flask Syntax A Flask application consists of routes that map URLs to Python functions ? from flask import Flask app = Flask(__name__) @app.route('/') def home(): ...
Read MoreFinding the Quantile and Decile Ranks of a Pandas DataFrame column
Quantile and decile ranks are statistical measures that determine the position of an observation relative to other values in a dataset. Quantile ranks show the percentage of values below each observation, while decile ranks divide data into 10 equal groups. In this tutorial, we will explore how to calculate both using Pandas DataFrame columns. Understanding Quantile and Decile Ranks A quantile rank represents the proportion of values in the dataset that are less than or equal to a given value. For example, if a value has a quantile rank of 0.7, it means 70% of the data falls ...
Read MoreFinding the outlier points from Matplotlib
Outliers are data points that differ significantly from other observations in a dataset. Identifying and handling outliers is crucial in data analysis as they can skew statistical results. This article demonstrates how to detect outlier points using Matplotlib's visualization capabilities in Python. Installation and Setup Matplotlib is a popular Python library for creating static, animated, and interactive visualizations. Install it using pip ? pip install matplotlib Understanding Boxplots for Outlier Detection The most common method for visualizing outliers is using boxplots. Matplotlib's boxplot() function creates box-and-whisker plots that clearly show outliers as points ...
Read MoreFinding the largest file in a directory using Python
Finding the largest file in a directory is a common task for disk space management, analyzing file distributions, or automating cleanup operations. Python's os module provides several approaches to accomplish this efficiently. Algorithm Import the os module Define a function called find_largest_file that takes a directory as input Initialize variables largest_file to None and largest_size to 0 Use os.walk() to traverse the directory tree recursively For each file, get the file size using os.path.getsize() Compare file size to current largest and update if necessary Return the path of the largest file Method 1: Using a ...
Read MoreFinding Duplicate Files with Python
Duplicate files consume unnecessary storage space on our computers. Finding and removing them manually can be time-consuming, but we can automate this process with Python using file hashing techniques. Required Modules We'll use Python's built-in os and hashlib modules, so no additional packages need to be installed ? import os import hashlib How It Works The algorithm works by: Creating a hashfile() function that generates a unique SHA-1 hash for each file Storing hash values in a dictionary as we scan through files When the same hash appears twice, we've found ...
Read MoreFinding Difference between Images using PIL
In image processing, finding the difference between two images is a crucial step in various applications. It is essential to understand the difference between the two images, which can help us in detecting changes, identifying objects, and other related applications. In this tutorial, we will explore how to find the difference between two images using the Python Imaging Library (PIL). Installation To use PIL, we need to install it using the pip package manager − pip install pillow Basic Syntax To find the difference between two images using PIL, we can use the ...
Read MorePython Program to Reverse Every Kth row in a Matrix
In Python, a matrix is a two-dimensional array where all elements have the same data type. Reversing every Kth row means flipping the order of elements in rows at positions K, 2K, 3K, and so on. In this article, we will learn different methods to reverse every Kth row in a matrix using Python. Problem Overview Given a matrix and a value K, we need to reverse the elements in every Kth row. For example, if K=2, we reverse the 2nd, 4th, 6th rows, etc. Input matrix = [[7, 1, 4], [3, 10, 6], ...
Read More