Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use vectorized functions in numpy #3

Open
cthoyt opened this issue Sep 8, 2017 · 0 comments
Open

Use vectorized functions in numpy #3

cthoyt opened this issue Sep 8, 2017 · 0 comments

Comments

@cthoyt
Copy link

cthoyt commented Sep 8, 2017

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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant