Server Side Programming Articles

Page 92 of 2109

Parent element method in Selenium Python

Priya Mishra
Priya Mishra
Updated on 27-Mar-2026 2K+ Views

Selenium is a robust tool that enables the automation of web browsers. A significant aspect of Selenium is its capability to find elements on web pages through diverse approaches, including the parent element method. By recognizing and manipulating the parent element associated with a particular target element, testers can effectively engage with specific sections of a webpage. This article explores the parent element method in Selenium Python, highlighting its benefits and practical implementation strategies. What is a Parent Element Method in Selenium Python? In HTML, elements are nested within other elements, creating a hierarchical structure. The parent ...

Read More

How to take a random row from a PySpark DataFrame?

Priya Mishra
Priya Mishra
Updated on 27-Mar-2026 5K+ Views

In PySpark, working with large datasets often requires extracting a random row from a DataFrame for various purposes such as sampling or testing. However, the process of selecting a random row can be challenging due to the distributed nature of Spark. In this article, we explore efficient techniques to tackle this task, discussing different approaches and providing code examples to help you effortlessly extract a random row from a PySpark DataFrame. Method 1: Using orderBy() and limit() One approach to selecting a random row from a PySpark DataFrame involves using the orderBy() and limit() functions. We add ...

Read More

Plotting Geospatial Data using GeoPandas

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 607 Views

GeoPandas is a powerful Python library built on top of Pandas that extends its capabilities to include geospatial data support. Geospatial data describes information related to various locations on Earth's surface, making it valuable for map visualization, urban planning, trade analysis, and network planning. In this article, we'll explore how to plot geospatial data using GeoPandas. What is GeoPandas? GeoPandas extends Pandas functionality to handle geometric data types and perform spatial operations. It combines the data manipulation capabilities of Pandas with the geospatial functionality of libraries like Shapely and Fiona. This makes it an excellent choice for working ...

Read More

Parallelizing a Numpy Vector Operation

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 574 Views

NumPy is a powerful Python library for storing and manipulating large, multi-dimensional arrays. Although NumPy is already fast and efficient, we can further enhance its performance using parallelization. Parallelizing means splitting tasks into multiple processes to achieve better performance. Python provides several ways to parallelize NumPy vector operations, including the multiprocessing and numexpr modules. Using Multiprocessing The multiprocessing module allows running multiple processes concurrently. It provides the Pool() method for creating and executing multiple tasks simultaneously. Example The following example shows how to square each element of a vector using parallelization ? import numpy ...

Read More

Plotting A Square Wave Using Matplotlib, Numpy And Scipy

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 2K+ Views

A square wave is a type of non-sinusoidal waveform widely used in electric and digital circuits to represent signals. These circuits use square waves to represent binary states like input/output or on/off. Python provides several ways to plot square waves using Matplotlib, NumPy, and SciPy libraries, which offer built-in methods for data visualization and signal processing. Required Libraries Overview Matplotlib The most widely used Python library for plotting, providing low-level control over graph elements like axes, labels, legends, colors, and markers. NumPy A powerful library for storing and manipulating large, multi-dimensional arrays. We'll use it to generate ...

Read More

Plot Line Graph from NumPy Array

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 4K+ Views

A line graph is a common way to display the relationship between two dependent datasets. Its general purpose is to show change over time. To plot a line graph from the NumPy array, we can use matplotlib which is the oldest and most widely used Python library for plotting. Also, it can be easily integrated with NumPy which makes it easy to create line graphs to represent trends and patterns in the given datasets. Basic Line Graph from NumPy Array Here's how to create a simple line graph using NumPy arrays and matplotlib ? import numpy ...

Read More

Print Full Numpy Array without Truncation

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 10K+ Views

NumPy is a powerful Python library for handling large, multi-dimensional arrays. However, when printing large NumPy arrays, the interpreter often truncates the output to save space and shows only a few elements with ellipsis (...). In this article, we will explore how to print a full NumPy array without truncation. Understanding the Problem To understand the truncation issue, consider this example: import numpy as np # Create a large array with 1100 elements array = np.arange(1100) print(array) [ 0 1 2 ... 1097 1098 ...

Read More

Plot the Size of each Group in a Groupby object in Pandas

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 2K+ Views

Pandas is a powerful Python library for data analysis that allows grouping of data using groupby(). Visualizing the size of each group helps understand data distribution patterns. Python provides libraries like Matplotlib, Seaborn, and Plotly to create informative plots from grouped data. Sample Dataset Let's start by creating a sample dataset to demonstrate plotting group sizes ? import pandas as pd # Creating sample data data = {'Group_name': ['A', 'A', 'B', 'B', 'B', 'C'], 'Values': [10, 12, 30, 14, 50, 16]} df = pd.DataFrame(data) print(df) ...

Read More

Percentile Rank of a Column in a Pandas DataFrame

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 3K+ Views

The percentile rank shows what percentage of values in a dataset are less than or equal to a given value. In pandas, we can calculate percentile ranks using the rank() method or scipy's percentileofscore() function. What is Percentile Rank? If a student scores in the 80th percentile, it means their score is greater than or equal to 80% of all other scores in the dataset. Using rank() Method The most common approach is using pandas' rank() method with pct=True parameter ? import pandas as pd # Create sample DataFrame data = {'Name': ['Ram', ...

Read More

Highlight Pandas DataFrame\'s Specific Columns using Apply()

Shriansh Kumar
Shriansh Kumar
Updated on 27-Mar-2026 2K+ Views

While presenting or explaining data using Pandas DataFrames, we might need to highlight important rows and columns to make them more appealing, explainable and visually stunning. One way of highlighting specific columns is by using the built-in apply() method with Pandas styling. Understanding apply() with Pandas Styling The apply() method is used to apply a user-defined function to each column or row of the Pandas DataFrame. To highlight specific columns, we first define a custom function that sets the required conditions for highlighting, then use the apply() method along with the style module. Syntax df.style.apply(function_name) ...

Read More
Showing 911–920 of 21,090 articles
« Prev 1 90 91 92 93 94 2109 Next »
Advertisements