Python – Statistics – Regression and Classification

Regression and Classification Regression models Getting started Regression is a technique used to model and analyze the relationships between variables contribute to producing a particular outcome. More concretely, it’s a way to determine which variables have an impact, which don’t, which factors interact, and how certain we are about this. (most common techniques – linear […]

Python – Statistics – EDA

Exploratory Data Analysis Descriptive Statistics Working with categorical data Relationship between two variables Descriptive Statistics what it sound like  help you describe the data with numerical calculations or plots many types – focus on most common ones : measures of centrality – measures of variability Measures of centrality Mean The mean is the average, which […]

Python – Object Oriented Programming – Design Inheritance & Properties

Best Practices Designing for Inheritance and Polymorphism Polymorphism   Interface # Withdraw amount from each account in list_of_accounts def batch_withdraw(list_of_accounts, amount): for acct in list_of_accounts: acct.withdraw(amount) b, c, s = BankAccount(1000), CheckingAccount(2000), SavingsAccount(3000) batch_withdraw([b,c,s]) # uses bankaccount.withdraw, checking, Savings batch_withdraw() doesn’t need to check the object to know which withdraw() to call Liskov substitution principle […]

Python – Object Oriented Programming – Exceptions

Integration with Python Operator overloading : comparison Object equality class Customer: def __init__(self, name, balance): self.name, self.balance = name, balance cust1 = Customer(“John Fisher”, 2100) cust2 = Customer(“John Fisher”, 2100) cust1 == cust2 > False   Variables are references class Customer: def __init__(self, name, balance, id): self.name, self.balance = name, balance self.id = id cust1 […]

Python – Object Oriented Programming – Class Inheritance

Inheritance and Polymorphism Instance and Class Data Core Principles of OOP Inheritance Extending functionality of existing code Polymorphism Creating an unified interface Encapsulation Bundling of data and Methods Instance-level data class Employee: def __init__(self, name, salary): self.name = name self.salary = salary emp1 = Employee(“Theo Mill”, 50000) emp2 = Employee(“Martina Kosova”, 65000) name , salary […]

Python Basics – Boolean Operations

Boolean Operations Boolean logic consists of operations done between True and False values : and ( logical conjunction) or ( logical disjunction) not ( logical negation ) Object Evaluation Evaluates as False Constants : False and None Numeric zero : 0 and 0.0 Lengths of zero : “” and [] Evaluates as True everything else […]

Python Basics – Comparison Operators

Comparison Operators Equality :  == , != Order: < , > , <= , >= Assignment Operator Assignment : =   13 == 13 > True count = 13 print(count) > 13 Equality Comparisons datetimes numbers ( float / int ) dictionaries strings … # Comparing dictionaries d1 = {‘high’:56.78,’low’:33.24,’closing’:56.77} d2 = {‘high’:56.78,’low’:33.24,’closing’:56.77} print(d1 == […]