Pradeep Elance has Published 445 Articles

Append multiple lists at once in Python

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:06:09

8K+ Views

For various data analysis work in python we may be needed to combine many python lists into one list. This will help processing it as a single input list for the other parts of the program that need it. It provides performance gains by reducing number of loops required for ... Read More

Accessing nth element from Python tuples in list

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:03:45

746 Views

A python list can contain tuples as its elements. In this article we will explore how to access every nth element form the tuples that are present as the elements in the given tuple.Using indexWe can design a for loop to access the elements from the list with the in ... Read More

Get positive elements from given list of lists in Python

Pradeep Elance

Pradeep Elance

Updated on 13-May-2020 14:00:46

353 Views

Lists can be nested, means the elements of a list are themselves lists. In this article we will see how to find out only the positive numbers from a list of lists. In the result a new list will contain nested lists containing positive numbers.With for inHere we simply apply ... Read More

Finding frequency in list of tuples in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:22:42

382 Views

Many different types of data container can get mixed up in python. A list can have elements each of which is a tuple. In this article we will take such a list and find the frequency of element in the tuples which are themselves elements of a list.Using count and ... Read More

Find sum of frequency of given elements in the list in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:21:16

404 Views

A given list has many repeated items. We are interested in finding out the sum of the frequency of some such items which are repeated in the list. Below are the approaches how we can achieve this.With sumWe have two lists. One has the list of values and other has ... Read More

Find frequency of given character at every position in list of lists in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:19:58

174 Views

Lets consider a scenario where you have a list which is made of lists as its elements. We are interested in finding the frequency of one character at different positions of the inner lists. Below example will clarify the requirement.Consider a list of lists given below.listA = [['a', 'a', 'b'], ... Read More

Find elements of a list by indices in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:17:19

5K+ Views

Consider two lists. The elements in the second list are numbers which needs to be considered as index position for elements of the first list. For this scenario we have the below python programs.With map and getitemWe can use the getitem magic method is used to access the list items. ... Read More

Extract only characters from given string in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:16:10

3K+ Views

A piece of data may contain letters, numbers as well as special characters. If we are interested in extracting only the letters form this string of data, then we can use various options available in python.With isalphaThe isalpha function will check if the given character is an alphabet or not. ... Read More

Extract numbers from list of strings in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:14:34

1K+ Views

While using python for data manipulation, we may come across lists whose elements are a mix of letters and numbers with a fixed pattern. In this article we will see how to separate the numbers form letters which can be used for future calculations.With splitThe split functions splits a string ... Read More

Equate two list index elements in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:13:02

470 Views

During data manipulation with Python , we may need to bring two lists together and equate the elements in each of them pair wise. Which means the element at index 0 from list 1 will be equated with element from index 0 of list2 and so on.With tupleThe tuple function ... Read More

Advertisements