Pradeep Elance has Published 417 Articles

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

582 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

Element with largest frequency in list in Python

Pradeep Elance

Pradeep Elance

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

513 Views

A lot of statistical data analysis tries to find the values which have maximum frequency in a given list of values. Python provides multiple approaches using which we can find such value form a given list. Below are the approaches.Using CounterThe Counter function from collections module has a options which ... Read More

Element repetition in list in Python

Pradeep Elance

Pradeep Elance

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

510 Views

There are scenarios when we need to repeat the values in a list. This duplication of values can be achived in python in the following ways.Using nested for loopIt is a straight forward approach in which pick each element, take through a inner for loop to create its duplicate and ... Read More

Dividing two lists in Python

Pradeep Elance

Pradeep Elance

Updated on 05-May-2020 10:06:59

2K+ Views

The elements in tow lists can be involved in a division operation for some data manipulation activity using python. In this article we will see how this can be achieved.With zipThe zip function can pair up the two given lists element wise. The we apply the division mathematical operator to ... Read More

Difference of two lists including duplicates in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:11:55

289 Views

Sometimes we need to find the differences between two lists. It will also mean a mathematical subtraction in which the elements from the first list are removed if they are present in the second list. Duplicates are preserved. Below is the approach through which we can achieve this.We can use ... Read More

Dictionary with index as value in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:10:53

834 Views

In this article we will learn how to create a dictionary from another frequently used python collection namely list. An index or key is not part a list content. But in dictionary we need to have a key or index attached to every element which is referred as value.Using enumerateThe ... Read More

Dictionary to list of tuple conversion in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:09:44

478 Views

ging the collection type from one type to another is a very frequent need in python. In this article we will see how we create a tuple from the key value pairs that are present in a dictionary. Each of the key value pair becomes a tuple. So the final ... Read More

Dictionary creation using list contents in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:08:06

175 Views

Changing the collection type from one type to another is a very frequent need in python. In this article we will see how we create a dictionary when multiple lists are given. The challenge is to be able to combine all these lists to create one dictionary accommodating all these ... Read More

Delete items from dictionary while iterating in Python

Pradeep Elance

Pradeep Elance

Updated on 04-May-2020 13:06:48

496 Views

A python dictionary is a collection which is unordered, changeable and indexed. They have keys and values and each item is referred using the key. In this article we will explore the ways to delete the items form a dictionary.Using del with keysIn this approach we capture the key values ... Read More

Advertisements