Kiran P has Published 125 Answers

How to scrape through Media Files in Python?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:53:30

IntroductionIn a real world corporate business setting, most data may not be stored in text or Excel files. SQL-based relational databases such as Oracle, SQL Server, PostgreSQL, and MySQL are in wide use, and many alternative databases have become quite popular.The choice of database is usually dependent on the performance, ... Read More

How to select the largest of each group in Python Pandas DataFrame?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:49:32

IntroductionOne of the most basic and common operations to perform during data analysis is to select rows containing the largest value of some columns within a group. In this post, I will show you how to find the largest of each group within a DataFrame.Problem..Let us understand the task first, ... Read More

How to unpack using star expression in Python?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:44:25

IntroductionOne of the basic limitation of unpacking is that you must know the length of the sequences you are unpacking in advance.How to do it..random_numbers = [0, 1, 5, 9, 17, 12, 7, 10, 3, 2] random_numbers_descending = sorted(random_numbers, reverse=True) print(f"Output \n*** {random_numbers_descending}")Output*** [17, 12, 10, 9, 7, 5, 3, ... Read More

How to perform Calculations with Dictionaries in Python?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:41:18

ProblemYou want to perform various calculations (e.g., minimum value, maximum value, sorting, etc.) on a dictionary of data.Solution.We will create a dictionary with tennis players and their grandslam titles.PlayerTitles = {    'Federer': 20,    'Nadal': 20,    'Djokovic': 17,    'Murray': 3,    'Theim' : 1,    'Zverev': 0 ... Read More

How to compare two DataFrames in Python Pandas with missing values

Kiran P

Kiran P

Updated on 09-Nov-2020 10:36:56

IntroductionPandas uses the NumPy NaN (np.nan) object to represent a missing value. This Numpy NaN value has some interesting mathematical properties. For example, it is not equal to itself. However, Python None object evaluates as True when compared to itself.How to do it..Let us see some examples to understand how ... Read More

How to write functions in Python that accept any number of arguments

Kiran P

Kiran P

Updated on 09-Nov-2020 10:32:00

ProblemYou want to write a function that accepts any number of input arguments.SolutionThe * argument in python can accepts any number of arguments. We will understand this with an example of finding out the average of any given two or more numbers. In the below example, rest_arg is a tuple ... Read More

How to use the Subprocess Module in Python?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:29:33

Understanding Process -When you code and execute a program on Windows, MAC or Linux, your Operating System creates a process(single).It uses system resources like CPU, RAM, Disk space and also data structures in the operating system’s kernel. A process is isolated from other processes—it can’t see what other processes are ... Read More

How to process iterators in parallel using ZIP

Kiran P

Kiran P

Updated on 09-Nov-2020 10:27:45

IntroductionList comprehensions make it easy to take a source list and get a derived list by applying an expression. For example, say that I want to multiply each element in a list with 5. Here, I do this by using a simple for loop.a = [1, 2, 3, 4, 5, ... Read More

How to implement Concurrency with Threads in Python?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:20:23

IntroductionPython has different approaches like using threads, subprocesses, generators and other tricks for concurrent programming.Before we go on and implement threads, let us understand what exactly is concurrency.Concurrency is a piece of logic Within a single program that allows to open up many distinct paths of execution, including separate streams ... Read More

How to process excel files data in chunks with Python?

Kiran P

Kiran P

Updated on 09-Nov-2020 10:18:17

IntroductionIt seems that the world is ruled by Excel. I've been surprised in my data engineering work to see how many of my colleagues are using Excel as a critical tool for making decisions. While I'm not a big fan of MS Office and their excel spread sheets, i will ... Read More

Advertisements