Pradeep Elance has Published 445 Articles

Decimal to binary list conversion in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:01:28

679 Views

Python being a versatile language can handle many requirements that comes up during the data processing. When we need to convert a decimal number to a binary number we can use the following python programs.Using formatWe can Use the letter in the formatter to indicate which number base: decimal, hex, ... Read More

Custom list split in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:00:43

405 Views

Data analytics throws complex scenarios where the data need to be wrangled to moved around. In this context let’s see how we can take a big list and split it into many sublists as per the requirement. In this article we will explore the approaches to achieve this.With zip and ... Read More

Create list of numbers with given range in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 12:59:09

15K+ Views

Python can handle any requirement in data manipulation through its wide variety of libraries and methods. When we need to generate all the numbers between a pair of given numbers, we can use python’s inbuilt functions as well as some of the libraries. This article describes such approaches.Using rangeThe range() ... Read More

Convert list of string to list of list in Python

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:34:31

728 Views

In this article we will see how to create a list of lists which contain string data types. The inner list themselves or of string data type and they may contain numeric or strings as their elements.Using strip and splitWe use these two methods which will first separate out the ... Read More

Python - cmp() Method

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:30:00

3K+ Views

The cmp() is part of the python standard library which compares two integers. The result of comparison is -1 if the first integer is smaller than second and 1 if the first integer is greater than the second. If both are equal the result of cmp() is zero.Below example illustrates ... Read More

Python - Clearing list as dictionary value

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:27:16

97 Views

In this article we consider a dictionary where the values are presented as lists. Then we consider clearing those values from the lists. We have two approaches here. One is to use the clear methods and another is to designate empty values to each key using list comprehension.Example Live Demox1 = ... Read More

Python - Check if frequencies of all characters of a string are different

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:21:19

143 Views

In this article we will see how to find the frequency of each character in a given string. Then see if two or more characters have the same frequency in the given string or not. We will accomplish this in two steps. In the first program we will just find ... Read More

Python - Check if dictionary is empty

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:17:58

5K+ Views

During analysis of data sets we may come across situations where we have to deal with empty dictionaries. In tis article we will see how to check if a dictionary is empty or not.Using ifThe if condition evaluates to true if the dictionary has elements. Otherwise it evaluates to false. ... Read More

Python - Check if all the values in a list are less than a given value

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:12:29

875 Views

In python data analysis, we sometime face a situation where we need to compare a given number with a list containing many values. In this article we need to fins if a given number is less than each of the values present in a given list. We are going to ... Read More

Possible Words using given characters in Python

Pradeep Elance

Pradeep Elance

Updated on 03-Mar-2020 06:11:04

634 Views

In this article we are going to see a python program that will give output of possible words from a given set of characters. Here we are taking a list as an input which will contain the set of reference words and another list containing the characters from which the ... Read More

Advertisements