+ 1

arr(arr(arr

The number of arr needed in front of the code and when is a bit confusing. I'm assuming that it's used twice when creating a new array by once when using the sum function but I'm not sure as to why.... Any answers???

9th Sep 2020, 4:09 AM
Alee
7 Antworten
+ 1
It's from the machine learning in the basic module on applying a mask to the array.... I searched for it just now but it's changed and has less arrr and is way less confusing.... I sorta get it now but I'm still wondering about how we're creating a new dataframe but not having to save it to a variable
10th Sep 2020, 12:35 PM
Alee
+ 1
I could have sworn that there were 3 arr( before the update... Anyway...here's the new code.... I'm still question the variable part https://code.sololearn.com/c3oysy6yRagQ/?ref=app
10th Sep 2020, 12:52 PM
Alee
+ 1
You did save the new dataframe in the df variable Then, you limit the number of data/row to 10 in arr After that, you created a mask which are used to filter away data in arr with age < 18 ( you can try print(mask), turns out it's an array of boolean) Finally, you applied the mask on arr with arr[mask]
10th Sep 2020, 1:11 PM
Heng Jun Xi
Heng Jun Xi - avatar
0
Can you refer us to the code? Or at least mention which language we are discussing?
10th Sep 2020, 12:21 PM
Heng Jun Xi
Heng Jun Xi - avatar
0
So am I modifying the df variable or is the mask just like an instance?
10th Sep 2020, 1:55 PM
Alee
0
Nope, you are not modifying the df or even the arr, the code is only storing the last 10 data from df into arr & filtering the arr the with the mask From what I observe from print(mask), mask is an array of boolean
10th Sep 2020, 2:25 PM
Heng Jun Xi
Heng Jun Xi - avatar
0
Hmmm.... Thanks friend
10th Sep 2020, 11:45 PM
Alee