Conversion Between Binary, Hexadecimal, and Decimal Numbers Using Coden Module

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

213 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 Image to JPG Format Using Pillow in Python

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

8K+ 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

Conversion Functions in Pandas DataFrame

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

329 Views

Pandas is one of the most potent libraries in python that provide high-performance data manipulation and analysis tools, it allows us to work with tabular data like spreadsheets, CSV, and SQL data using DataFrame. A DataFrame is a 2-dimensional labeled data structure it represents the data in rows and columns format. Data present in each column may have different data types. DataFrame: Integers Floats Strings Dates 0 1.0 1.300 p 2023-05-07 1 2.0 NaN y 2023-05-14 2 5.0 4.600 t 2023-05-21 3 3.0 1.020 h 2023-05-28 4 6.0 0.300 o 2023-06-04 5 NaN 0.001 n 2023-06-11 The DataFrame demonstrated above is having 6 rows and 4 columns and the data present in each row has different datatypes. And Conversions functions ... Read More

Convert Nested For Loop to Map Equivalent in Python

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

789 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

2K+ 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

Convert Numpy Array to Pandas Series

Gireesha Devara
Updated on 30-May-2023 13:16:19

2K+ Views

A Numpy array is an N-dimensional array also called a ndarray, it is a main object of the NumPy library. In the same way, the pandas series is a one-dimensional data structure of the pandas library. Both pandas and NumPy are validly used open-source libraries in python. Below we can see the one-dimensional numpy array. NumPy array array([1, 2, 3, 4]) The pandas Series is a one-dimensional data structure with labeled indices and it is very similar to a one-dimensional NumPy array. Pandas Series: 0 1 1 2 2 3 ... Read More

Convert Numpy Array to Pandas DataFrame with Headers

Gireesha Devara
Updated on 30-May-2023 13:14:13

2K+ Views

Both pandas and NumPy are validly used open-source libraries in python. Numpy stands for Numerical Python. This is the core library for scientific computing. A Numpy array is a powerful N-dimensional array object which is in the form of rows and columns. NumPy array array([[1, 2], [3, 4]]) Pandas provide high-performance data manipulation and analysis tools in Python, it allows us to work with tabular data like spreadsheets, CSV, and SQL data. And it has data structures like DataFrame and Series that are mainly used for analyzing the data. DataFrame is a 2-dimensional labeled data structure used to ... Read More

Reverse Elements of Array Using Inbuilt Function in Python

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

317 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

Find Index of First Occurrence of Item in Array using Python

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

3K+ 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

Insert Multiple Elements into an Array from Specified Index in Python

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

2K+ 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