Found 10784 Articles for Python

OpenCV Python program to read and save an Image

Gireesha Devara
Updated on 30-May-2023 15:31:19

959 Views

OpenCV-python is an Open Source Computer Vision Library in python it is used to process images and videos for detecting faces and objects. It is one of the image processing libraries in python and uses the python Numpy library so that all the image arrays are represented as a ndarray type. Install OpenCV using pip Pip install opencv-python OpenCV needs the numpy library, we need to make sure that the numpy library is also installed. The Python OpenCV module provides functions cv2.imread() and cv2.imwrite() to read/load and write/save image files. In this article, we will see reading ... Read More

Contour Plot using Python Matplotlib

Gireesha Devara
Updated on 30-May-2023 15:25:12

792 Views

Matplotlib is free and open-source plotting library in python. It is used to create 2-Dimensional graphs and plots by using python scripts. To utilize the matplotlib functionalities we need to install the library first. Install using pip By execute the below command in the command prompt we can easily install the latest stable package for Matplotlib from PyPi. pip install Matplotlib You can install Matplotlib through conda, using the following command – conda install -c conda-forge matplotlib A Contour plot is used for visualizing three-dimensional data in a two-dimensional surface by plotting constant z slices, called contours. ... Read More

Contour Plots using Plotly in Python

Gireesha Devara
Updated on 30-May-2023 15:17:55

334 Views

In python Plotly referred as "plotly.py". It is a free and open-source plotting library that is built on top of “plotly.js”. It supports more than 40 unique chart types. This library is mainly used for financial, geographical, scientific, 3-dimensional, and data analysis applications. It can be used to plot various types of charts and graphs like scatter plots, line plots, bar charts, box plots, histograms, pie charts, area charts, box plots, histograms, heatmaps, subplots, multiple-axes, etc. Installing plotly Execute the below commands in the command prompt to install the plotly module. It is an easy way to install the ... Read More

Conversion between binary, hexadecimal and decimal numbers using Coden module

Gireesha Devara
Updated on 30-May-2023 14:57:06

109 Views

The coden is a python library developed by Tanmay Earappa, which is used for secret codes (decoding and encoding secret codes). This module provides functionalities to do the code conversions. Following are few functions and their functionalities provided by this module – coden.secret(): It is used for decode or encode the secret codes based on the input of the mode parameter. hex_to_bin(): It will do the Hexadecimal to Binary conversion. int_to_bin(): It will do the Decimal to Binary conversion. int_to_hex(): It will do the Decimal to Hexadecimal conversion Install Coden with pip With the pip command we can ... Read More

Convert an image into jpg format using Pillow in Python

Gireesha Devara
Updated on 30-May-2023 14:53:05

5K+ Views

In python pillow is one of the image processing libraries that is built on top of PIL (Python Image Library). It provides image processing functionalities to the python interpreter to work with image objects. And this library supports above 30 different image file formats. Install Pillow with pip By installing pillow using the pip command we can easily access the pillow functionalities. python3 -m pip install --upgrade pip python3 -m pip install --upgrade Pillow Just by running the above commands in the command prompt we will get the pillow module. In this article, we will discuss converting ... Read More

Convert a nested for loop to a map equivalent in Python

Gireesha Devara
Updated on 30-May-2023 14:28:52

495 Views

In general, for loop is used to execute/iterate a block of code a fixed number of times. And nested for loop is nothing but, iterating a block of code for x number of times, then we need to run another block of code within that code for y number of times. Nested for loop syntax for x in sequence: for y in sequence: inner loop outer loop The map is a built-in function in python that is used to iterate the items of a sequence and ... Read More

Convert "unknown format" strings to datetime objects in Python

Gireesha Devara
Updated on 30-May-2023 13:25:44

1K+ Views

Dates can be in many formats like: “2009/05/13 19:19:30”, “May 13 2009 07:19PM", and “2009-05-13 19:19”. Python provides many modules to work with data related to date times. To read an unknown format of date strings into a python datetime object, we can use the python dateutil, datetime modules. The python datetime object is a single object that has all the information about the date and time objects. It represents the data related to the year, month, day, hours, mintunes, seconds, and time zones also. In this article below, we will see how to convert the unknown format strings to ... Read More

Python Program to reverse the elements of the array using inbuilt function

Gireesha Devara
Updated on 29-May-2023 15:34:39

228 Views

An array is a data structure that is used to store homogeneous elements in order. And the stored elements are identified by an index value or a key. Python doesn’t have a specific data structure to represent arrays. However, we can use the List data structure or Numpy module to work with arrays. In the article below, we will see how to reverse the elements of an array using the python built-in functions. Reverse the elements of an array means changing the order of array elements from front to back. Input Output Scenarios Let us now look at some ... Read More

Python Program to find the index of the first occurrence of the specified item in the array

Gireesha Devara
Updated on 29-May-2023 15:31:14

2K+ Views

An array is a data structure that is used to store elements of the same data type in order. And the stored elements are identified by an index value. Python doesn’t have a specific data structure to represent arrays. However, we can use the List data structure or Numpy module to work with arrays. In this article, we see multiple ways to get the index of the first occurrence of a specified item in the array. Input Output Scenarios Let us now look at some input output scenarios. Assume we have an input array with few elements. And in the ... Read More

Python Program to insert multiple elements into the array from the specified index

Gireesha Devara
Updated on 29-May-2023 15:26:24

1K+ Views

An array is a collection of homogeneous data elements stored in an organized way. And each data element in the array is identified by an index value. Arrays in python Python does not have a native array data structure. So that, we can use the list data structure as an alternative to the arrays. [10, 4, 11, 76, 99] Also we can Python Numpy module to work with arrays. An array defined by the numpy module is − array([1, 2, 3, 4]) The indexing in python starts from 0, so that the above array elements are accessed ... Read More

Advertisements