math4computer 1. data and matrix - lunawyh/covid19viz GitHub Wiki

  1. Data types

    Python data types

  2. List

    List operation

  3. Matrices in math class

    Introduce Matrices

    Transpose Matrices

    Matrices to solve a system of equations

  4. 2D matrix with numpy

    Python matrix and operations

4.1 from list to array (codes for CA)

    arr_data_all = numpy.array(lst_data)
    # get kinds of date
    l_dates = sorted( list(set(arr_data_all[1:].T[1])) )

4.2 array operations (codes for IL)

    total_cases = (sum(map(int, l_cases2[1])))
    total_death = (sum(map(int, l_cases2[2])))

4.3 array appending and sharping (codes for FL)

    l_cases2 = np.reshape(nam_num_case, (len(nam_num_case)/5, 5)).T
    l_data = np.vstack((l_cases2[0], l_cases2[3], l_cases2[4])).T