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
Server Side Programming Articles
Page 37 of 2109
How to Add A Color Picker In Bokeh?
Bokeh is one of the most underrated Python visualization libraries and can be used for various applications, including data analysis, scientific visualization, interactive dashboards, etc. In this article, we will learn how to add a color picker widget in Bokeh. What's A Color Picker? A color picker is one of the many widgets present in Bokeh. It helps the user to specify an RGB color value. Widgets add interactions to the graphs, which can then help users to update plots or drive new computations without diving into code. Besides the color picker, Bokeh has many interesting widgets like ...
Read MoreUnion of Python Tuples
A tuple is a sequential, immutable data structure in Python consisting of multiple values. Since tuples are immutable, finding their union requires creative approaches using mutable data structures like sets. The union operation combines elements from multiple tuples while removing duplicates. The union of Python tuples finds applications in removing duplicates, merging data sources, set operations, data deduplication, merging multiple results, database operations, handling data overlaps, and set operations in machine learning. Using Set and '+' Operator Convert tuples to a set after concatenation. Sets automatically remove duplicate elements ? # Taking two tuples tuple1 ...
Read MorePython - Type conversion in Nested and Mixed List
Python lists are heterogeneous and can contain nested structures, making type conversion a crucial skill. When working with nested lists (lists within lists) or mixed lists (containing different data types), we need special techniques to convert elements while preserving the original structure. In this article, we will explore three effective methods for type conversion in nested and mixed lists using list comprehension, recursion, and the map() function. Understanding Nested and Mixed Lists A nested list contains other lists as elements, creating a hierarchical structure. A mixed list contains elements of different data types like integers, strings, lists, ...
Read MorePython - Convert List to Single Valued Lists in Tuple
Converting a list to a tuple of single-valued lists is a common data transformation in Python. Each element from the original list becomes a separate list containing just that element, and all these lists are wrapped in a tuple. For example, [1, 2, 3] becomes ([1], [2], [3]). Using List Comprehension and tuple() List comprehension provides the most readable and Pythonic approach for this transformation ? demo_list = [1, 2, 3, 4, 5] print("Initial List:", demo_list) # Using list comprehension with tuple() function final_tuple = tuple([x] for x in demo_list) print("Final Tuple:", final_tuple) ...
Read MoreHow to print Superscript and Subscript in Python?
Python provides several methods to print superscript and subscript characters for mathematical expressions, chemical formulas, and formatted text output. This article explores different approaches using Unicode characters, custom functions, and external libraries. Understanding Superscript and Subscript Superscript: Text that appears above the baseline, commonly used for mathematical exponents like x² or footnotes. The smaller-sized text is raised above the normal text line. Subscript: Text that appears below the baseline, typically used in chemical formulas like H₂O or mathematical notations. The smaller-sized text is lowered below the normal text line. Method 1: Using Unicode Characters Python ...
Read MoreHow to Print Multiple Arguments in Python?
Python's print() function can handle multiple arguments in various ways. Understanding these techniques helps you create clear, readable output for different data types and formatting needs. Basic print() Function The simplest way to print multiple values is by passing them as separate arguments to print() ? name = "Alice" age = 25 city = "New York" print("Name:", name, "Age:", age, "City:", city) print(name, age, city, sep=" | ") Name: Alice Age: 25 City: New York Alice | 25 | New York Using f-Strings (Recommended) F-strings provide the most readable ...
Read MoreHow to Position Legends Inside a Plot in Plotly-Python?
Plotly-Python is a powerful visualization library that allows data scientists to create interactive plots with customizable legends. By default, Plotly positions legends outside the plot area, but positioning them inside can improve aesthetics, save space, and enhance the overall user experience. In this guide, we'll explore different methods for positioning legends inside plots using Plotly-Python's layout.legend property and coordinate system. Understanding Legend Positioning Legends in Plotly use a coordinate system where values range from 0 to 1. The coordinates (0, 0) represent the bottom-left corner, while (1, 1) represents the top-right corner of the plot area. This ...
Read MoreHow to Plot a Ricker Curve Using SciPy - Python?
The Ricker curve, also known as the Mexican Hat wavelet, is a symmetric bell-shaped waveform widely used in signal processing and seismic exploration. SciPy provides built-in functions to generate and plot this important wavelet for analyzing subsurface structures and signal characteristics. What is the Ricker Curve? The Ricker curve is the second derivative of a Gaussian function, characterized by a central peak followed by oscillations that decay on both sides. This distinctive shape makes it ideal for detecting transient phenomena in signals and modeling seismic waves in geophysical applications. Prerequisites Before plotting the Ricker curve, ensure ...
Read MoreHow to Delete the True Values in a Python List?
In Python, lists are one of the most commonly used data structures that allow us to store various elements. Sometimes, we may encounter situations where we need to remove specific boolean values from a list. In this article, we will explore six different methods to remove True values from a Python list. Problem Statement Consider a list containing a mixture of boolean values and other data types, and we need to remove all occurrences of True from that list. Let's see an example ? Input: sample_list = [True, 2, False, True, 4, True, 6, True] ...
Read MoreHow to Convert Dictionary values to Absolute Magnitude using Python?
Converting dictionary values to their absolute magnitude means transforming negative values to positive while keeping positive values unchanged. Python provides several approaches to achieve this transformation using the built-in abs() function. Understanding the abs() Function The abs() function returns the absolute value of a number. For real numbers, it returns the positive value. For complex numbers, it returns the magnitude. # Basic abs() usage print(abs(-5)) # Positive number print(abs(5)) # Already positive print(abs(-3.14)) # Float number 5 5 3.14 Method 1: Using For Loop ...
Read More