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 […]
Python Tips
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 […]
How To Loop Through Pandas Rows? or How To Iterate Over Pandas Rows?
Sometimes you may want to loop/iterate over Pandas data frame and do some operation on each rows. Pandas has at least two options to iterate over rows of a dataframe. Let us see examples of how to loop through Pandas data frame. First we will use Pandas iterrows function to iterate over rows of a […]
How To Specify Colors to Boxplots in Seaborn?
Boxplots with actual data points are one of the best ways to visualize the distribution of multiple variables at the same time. Creating a beautiful plot with Boxplots in Python Pandas is very easy. In an earlier post, we saw a good example of how to create publication quality boxplots with Pandas and Seaborn. If […]
How to Change Type for One or More Columns in Pandas Dataframe?
Sometimes when you create a data frame, some of the columns may be of mixed type. And you might see warning like this DtypeWarning: Columns (0) have mixed types. Specify dtype option on import or set low_memory=False. We get this error when Pandas tries to guess the type for each element of a column. For […]