#Python

Tags: 28 posts

August 23, 2019 2 min read

Part 2 - Plotting Using Seaborn - Distribution Plot, Facet Grid

Introduction and Data preparation Please follow the folloing links regarding data preparation and previous posts to follow along - For Data Preparation - Part 0 - Plotting Using Seaborn - Data Preparation{:target="_blank"} For Part 1 - …
August 21, 2019 3 min read

Part 1 - Plotting Using Seaborn - Violin, Box and Line Plot

Introduction and Data preparation Please follow the folloing links regarding data preparation and previous posts to follow along - For Data Preparation - Part 0 - Plotting Using Seaborn - Data Preparation{:target="_blank"} Violin Plot …
August 20, 2019 3 min read

Part 0 - Plotting Using Seaborn - Data Preparation

Import Preliminaries and datasets import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import matplotlib.pylab as plb import warnings warnings.filterwarnings('ignore') test_scores = pd.read_csv("Data/Test …
July 8, 2019 4 min read

Exception handling in Python

Try and Except Handle Exceptions Exceptions Attributes Handling Multiple Exceptions Else Finally Try and Except Handle Exceptions The following statement will throw an error as string can’t be parsed into integers. hello = "hello …
June 29, 2019 3 min read

Functions in Python - return, scope, args and kwargs

Return in Function Scoping in Function Access global variable in function context Declare a local variable within in a function Declare local variable with same name as in global Using Global Keyword *args and **kwargs in function Return in Function …
June 28, 2019 2 min read

Break, Continue and Pass in Python

Continue vs Break Continue print("The loop will skip the value when value of i is 2 and restart from next value of i - ") for i in range(0,4): if i == 2: continue else: print(i+100) Output: The loop will skip the value when value of i is 2 …
May 30, 2019 4 min read

Months between two dates

Importing Packages and Datasets import pandas as pd import numpy as np start_date = ['2019-06-03', '2019-06-13', '2018-11-05', '2019-05-31', '2019-06-01', '2019-09-01'] end_date = …
May 30, 2019 1 min read

Business Days with Custom Holidays

Importing Packages and Datasets import pandas as pd start_date = ['2019-06-03', '2019-06-13', '2019-10-01', '2019-09-01'] end_date = ['2019-08-31', '2019-06-21', '2019-10-25', …
April 23, 2019 1 min read

Applying functions over pandas dataframe using apply, applymap and map

Importing Packages and Datasets import pandas as pd import numpy as np data = pd.DataFrame(np.random.rand(4, 3)*100, columns=['Physics','Çhemistry','Maths'], index = ['Student 1', 'Student 2','Student …
April 3, 2019 2 min read

Filtering using mask and where in pandas

Filtering a dataframe can be achieved in multiple ways using pandas. There are times when you simply need to update a column based on a condition which is true or vice-versa. In pandas dataframe there are some inbuilt methods to achieve the same …