Pradeep Elance has Published 498 Articles

Python - Convert 1D list to 2D list of variable length

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:20:56

A list in python is normally a 1D list where the elements are listed one after another. But in a 2D list we have list nested inside the outer list. In this article we will see how to create a 2D list from a given 1D list. We also supply ... Read More

Python - Convert a list of lists into tree-like dict

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:19:45

Given a nested list we want to convert it to a dictionary whose elements can be considered as part of a tree data structure. In this article we will see the two approaches to convert a nested list into to add dictionary whose elements represent a tree like data structure.Using ... Read More

Python - Convert flattened dictionary into nested dictionary

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:18:13

Python dictionaries have keys and values. If we have two or more dictionaries to be merged a nested dictionary, then we can take the below approaches. Here year the dictionaries are given along with the new keys that will become a key in the nested dictionary.Assigning keysIn this approach we ... Read More

Python - Combine two dictionary adding values for common keys

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:17:05

When analyzing data with python we come across situations when we have to merge two dictionaries in such a way that we add the values of those elements whose keys have equal values. In this article we will see such two dictionaries getting added.With For loop and | OperatorIn this ... Read More

Python - Check if k occurs atleast n times in a list

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:15:57

Many times during data analysis using lists we come across a situation where we need to find out if a given element is present at least N Times in the given list. For example if 5 is present at least three times in the list or not. In this article ... Read More

Pygorithm module in Python

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:14:03

The Pygorithm module is an educational module containing the implementation of various algorithms. The best use of this module is to get the code of an algorithm implemented using python. But it can also be used for actual programming where we can apply the various algorithms to a given data ... Read More

Polymorphism in Python

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:12:46

Polymorphism means multiple forms. In python we can find the same operator or function taking multiple forms. It also useful in creating different classes which will have class methods with same name. That helps in re using a lot of code and decreases code complexity. Polymorphism is also linked to ... Read More

OS Path module in Python

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:11:29

The os.path module is a very extensively used module that is handy when processing files from different places in the system. It is used for different purposes such as for merging, normalizing and retrieving path names in python . All of these functions accept either only bytes or only string ... Read More

Oracle Database Connection in Python

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:10:19

Python can connect to oracle using a python package called cx_Oracle. Oracle is one of the famous and widely used database and python’s data processing features are leverages well using this connectivity. In this article we will see how we can connect to oracle database and query the DB.Installing cx_OracleWe ... Read More

The netrc file processing using Python

Pradeep Elance

Pradeep Elance

Updated on 28-Dec-2020 11:08:34

The netrc class in python is used to read the data from the .netrc file presnt in unix systems in user’s home firectory. These are hidden files containing user’s login credential details. This is helpful for tool slike ftp, curl etc to successfully read the ,netrc file and use it ... Read More

Advertisements