Normal python

  • to write multiple commands in the same line, seperate them with a semicolon
  • python supports complex numbers, a=1+2j or by complex class
  • ord gives the ascii number for the character

Numpy mathematical function

  • np.add, np.substract, etc.. there are a lot of mathemtical functions, the operate element wise, yes even np.multiply
  • To create a custom defined function, create a normal python function, ex:
def add3(x, y, z):
	return x + y + z

then do the following

add3func = np.frompyfunc(add3, n_of_inputs, n_of_outputs)
 
# then u can use the above as a function
add3func(x, y, z)

Maybe Important

Pandas

  • to create date indices use pd.date_range("yearmonthday", period=6) this returns a DatetimeIndex
  • When dict data is used to define a Series or a Dataframe, the index and column parameters are like selecting data from that dict
  • you can only drop rows not columns but can del columns not rows, drop can be done inplace
  • you can concat two dataframes
  • you can read_csv, read_json, there is also dropna and fillna, we also have dataframe.info that pritns some information like non null entries, memory usage etc