Skip to content

Use vectorized functions in numpy #3

@cthoyt

Description

@cthoyt

You can use vectorized operations in numpy to operate over entire arrays, then list unpack.

Also, remember that <- isn't a valid assingment in Python and the R people also finally decided to stop doing this too (it's only in legacy code or from legacy coders)

f_n_pp <- floor(twoByTwoContingencyTable[0]) #(floor in R/python --> largest integer value less than or equal to x)
f_n_pm <- floor(twoByTwoContingencyTable[1])
f_n_mp <- floor(twoByTwoContingencyTable[2])
f_n_mm <- floor(twoByTwoContingencyTable[3])

f_n_pp,  f_n_pm, f_n_mp, f_n_mm = np.floor(twoByTwoContingencyTable[0:4])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions