#2 Small Win
date
May 6, 2023
slug
2-smallwin
status
Published
tags
summary
Finished the one small intro part
time
4h-30m
type
Post
Finished the first course Introduction to python, learned a few things related to Numpy. I forgot the last time I wrote something using Numpy. So, This felt like a complete first time learning experience with occasional “Ahh! I know that” moments. The topic wasn’t in too much detail yet my pace was also a bit slow as I was pretty exhausted by the day even before starting. Need to shift this activity at the start of the day rather than at the end.
I needed a refresher on function vs methods, I could only think of a single point that functions are independent and methods are associated with a objects and classes. Got some help with chatGPT and here are a few more
- Functions, being defined independently with
def
keyword can take zero or more arguments. Methods on other hand are defined inside a class and have at least one default argument which is object instance akaself.
- Functions can be imported in other modules while methods are to be used with associated classes and objects.
Dot notation is also used when importing from sub packages, like in the case of
import from scipy.linalg import inv
.Numpy (Numerical Python) Arrays are strongly typed, i.e., don’t allow for intermixing of data type.
Subarrays Comma Notation, I really like this one as it resembles to a system developed.
2D subarrays
Arithmetic with numpy arrays
Boolean Based Indexing (subsetiting)