Off topic:How To Process Array In Python As In R
5
1
Entering edit mode
11.6 years ago
cutin ▴ 10

Dear all,

I have an array, namely A, (m rows and n columns), I would like to calculate "sum of a column if criteria in other columns"

Example: sum of the 2nd column and criteria in the first column

In R:

sum(A[A[, 1] < h, 2])

How I can do it in python without loops?

Thanks,

python array r • 2.6k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2658 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6