One of the most common tasks in data science is to manipulate the data frame we have to a specific format. For example, sometime we may want to take data frame with fewer columns, say in long format, summarize and convert into a data frame with multiple columns, i.e. a wide data frame. Python Pandas […]
Python
How To Merge/Join DataFrames with Pandas in Python?
One of the most common data science tasks – data munge/data cleaning, is to combine data from multiple sources. When you have the data in tabular forms, Python Pandas offers great functions to merge/join data from multiple data frames. Here we will see example scenarios of common merging operations with simple toy data frames. Let […]
3 Ways To Create a List Repeating an Item
Sometimes, you may want to create a list in Python such that it contains the same element repeated many times. In Python, you can create such a repeat list easily using many approaches. Here are three ways one can create a list with a single element repeated ‘n’ times. 1. How to Create a Repeat […]
Simulating Coin Toss Experiment in Python with NumPy
Tossing a one or more coins is a great way to understand the basics of probability and how to use principles of probability to make inference from data. Let us simulate coin toss experiment with Python. Mathematically, coin toss experiment can be thought of a Binomial experiment, where we have a coin with probability of […]
10 Basic Arithmetic Operations with NumPy array
NumPy is one of most fundamental Python packages for doing any scientific computing in Python. NumPy’s N-dimenisonal array structure offers fantastic tools to numerical computing with Python. Let us see 10 most basic arithmetic operations with NumPy that will help greatly with Data Science skills in Python. Let us first load the NumPy library Let […]