Found 10784 Articles for Python

How to Print Multiple Arguments in Python?

Pranay Arora
Updated on 29-Aug-2023 13:08:49

1K+ Views

Python is one of the most widely used programming languages due to its powerful dynamic functionalities and ease of writing codes. It is great for beginners as well to start their programming journey. One very popular start code or beginner code is to understand and implement printing ‘Hello world’ in our console. In python, we use a print() statement to achieve the same. print("Hello World!!!") In this article, we will try to understand the print() module and learn how to print multiple arguments in Python. When we try to display anything in the console or window, there are often ... Read More

How to Position Legends Inside a Plot in Plotly-Python?

Pranay Arora
Updated on 29-Aug-2023 13:05:26

2K+ Views

Data visualization is a powerful tool that allows us to understand information examples, patterns, and bits of knowledge all the more really. Plotly-Python, a flexible and intuitive plotting library, gives information researchers, specialists, and experts with the capacity to make outwardly engaging and intelligent plots. Among the critical components of any plot is the legend, which assumes a significant part in assisting watchers with grasping the information and distinguish various components present in the representation. As a matter of course, Plotly positions legends outside the plot region, normally on the right-hand side. While this arrangement is reasonable for ... Read More

How to plot Timeseries based charts using Pandas?

Pranay Arora
Updated on 29-Aug-2023 13:03:19

41 Views

Often in our daily life, we come across various interactive graphical data. In our daily work life or business, we come across several data sets or charts that help us in decision making, future predictions and much more. One such set of data that we come across in our daily encounters is Time Series data. A series of data or data points collected in regular intervals of time, such a time bound data set is called Time Series data. These data sets are collected at fixed intervals of time. A simple example can be our weather data, or may be ... Read More

How to Plot a Ricker Curve Using SciPy - Python?

Pranay Arora
Updated on 29-Aug-2023 13:01:02

100 Views

Python is one of the most popular and versatile programming languages. It is a dynamically-typed, high level language. It offers support for multiple libraries and tools for various scientific and mathematical research. It is hence widely used in data analysis and research. SciPy is a widely used python library, which provides a collection of functions and abilities for scientific computing. In this article, we will learn and understand how to plot a Ricker curve using SciPy in Python. The Ricker curve, which is also popular as the Mexican Hat wavelet, is commonly used in signal processing, seismic exploration, etc. By ... Read More

How to Delete the True Values in a Python List?

Pranay Arora
Updated on 29-Aug-2023 12:59:15

196 Views

In Python, lists are perhaps of the most regularly used datum structures that permit us to store different elements. Now and then, we might experience circumstances where we really want to remove explicit elements from a list. In this article, we will discuss five distinct methods to remove the True values from a Python list. We will examine the algorithm, give code examples, show the result, and close with a correlation of the methods. Introduction Consider a situation where we have a list containing a combination of boolean type and different information types, and we need to remove all events ... Read More

How to Convert Dictionary values to Absolute Magnitude using Python?

Pranay Arora
Updated on 29-Aug-2023 12:56:53

105 Views

Dictionaries are data structures that can contain key and values of any data type. The values can be of integer type as well. In this article we are going to see How to Convert Dictionary values to Absolute Magnitude using Python which simply means if a value is in negative it will be converted to it’s absolute or positive value while positive values will remain as it is. I/O Example Input = {'a':1 , 'b' : -1} Output = {'a':1 , 'b' : 1} To do this conversion, there are lot of techniques however 1 function that ... Read More

How to Convert dictionary to K sized dictionaries using Python?

Pranay Arora
Updated on 29-Aug-2023 12:54:11

62 Views

Dictionaries are key-value data structures in python where in the keys are unique and values can be repeated or not. The keys and values can be of any data type. In this article we are going to see How to Convert dictionary to K sized dictionaries using Python which simply means we will divide a dictionary into k-smaller dictionaries where k is any positive number i.e. k>0. Example Let the input dictionary be d = {'a': 1, 'b': 2, 'c': 3, 'd': 4, 'e': 5, 'f': 6, 'g': 7, 'x': 8, 'y': 9} The corresponding output should be {'a': 1, ... Read More

How to take integer input in Python?

Tushar Sharma
Updated on 28-Aug-2023 20:49:34

571 Views

The acquisition of integer input holds immense significance in various programming tasks, and the Python programming language offers a plethora of techniques to achieve this goal. This article embarks on an insightful journey to explore diverse methodologies for acquiring integer input in Python, focusing on the following strategies: Unveiling the Potential of the `input()` Function and `int()` Type Conversion Harnessing the Versatility of the `map()` Function Unearthing Integer Input from File Sources Attaining Integer Input via Command Line Arguments Method 1: ... Read More

How to swap columns of a given NumPy array?

Tushar Sharma
Updated on 28-Aug-2023 20:48:11

1K+ Views

When it comes to manipulating NumPy arrays, there might be instances where you want to interchange the positions of two columns. In this article, we delve into four distinct techniques to exchange columns in a given NumPy array: utilizing advanced indexing, employing NumPy indexing, harnessing the np.swapaxes function, and leveraging direct assignment. We will comprehend these methods through illustrative examples. Method 1: Exploiting Advanced Indexing Unleashing the potential of advanced indexing, you open the capability to reshape the course of action of measurements inside a NumPy cluster, much obliged to a choosy curated program of column indices. ... Read More

How to suppress the use of scientific notations for small numbers using NumPy?

Tushar Sharma
Updated on 28-Aug-2023 20:45:14

127 Views

When working with NumPy arrays, you may encounter small numbers represented in scientific notation. Although this compact representation is advantageous, deciphering or comparing values can be arduous. This guide delves into four distinct techniques to abate scientific notation usage for diminutive numbers in NumPy arrays: employing numpy.vectorize alongside string formatting, utilizing numpy.ndarray.round, leveraging string formatting, and harnessing numpy.set_printoptions. Examples will elucidate these methodologies, discussing pros and cons, and providing an all-encompassing comprehension of each approach. Method 1: Using numpy.vectorize with string formatting numpy.vectorize function, when combined with string formatting, can suppress scientific notation in NumPy arrays. This approach ... Read More

Advertisements